Fix putenv and unsetenv on MS-Windows.

src/w32.c (unsetenv): Return 0 if the input string is too long.

 nt/inc/ms-w32.h (sys_putenv): Add prototype.

Fixes: debbugs:13070
This commit is contained in:
Eli Zaretskii 2012-12-08 20:27:37 +02:00
parent 5745a7df2b
commit a16e75cd3c
4 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,7 @@
2012-12-08 Eli Zaretskii <eliz@gnu.org>
* inc/ms-w32.h (putenv): Redirect to sys_putenv.
(sys_putenv): Add prototype.
* config.nt (HAVE_UNSETENV): Define to 1.

View file

@ -381,6 +381,7 @@ extern char *get_emacs_configuration_options (void);
# undef putenv
#endif
#define putenv sys_putenv
extern int sys_putenv (char *);
extern int getloadavg (double *, int);
extern int getpagesize (void);

View file

@ -1,3 +1,7 @@
2012-12-08 Eli Zaretskii <eliz@gnu.org>
* w32.c (unsetenv): Return 0 if the input string is too long.
2012-12-08 Paul Eggert <eggert@cs.ucla.edu>
Use putenv+unsetenv instead of modifying environ directly (Bug#13070).

View file

@ -1562,7 +1562,7 @@ unsetenv (const char *name)
if (name_len > 32767)
{
errno = ENOMEM;
return -1;
return 0;
}
/* It is safe to use 'alloca' with 32K size, since the stack is at
least 2MB, and we set it to 8MB in the link command line. */