1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

Correction to:

(scm_putenv): Free temporary ptr in mingw unset.

Need to ensure "e" is not unused when unsetenv is available.
This commit is contained in:
Kevin Ryde 2003-06-11 23:24:08 +00:00
parent c3ae8e07fc
commit f158788fd1

View file

@ -1157,7 +1157,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
"The return value is unspecified.") "The return value is unspecified.")
#define FUNC_NAME s_scm_putenv #define FUNC_NAME s_scm_putenv
{ {
int rv, e; int rv;
char *ptr; char *ptr;
SCM_VALIDATE_STRING (1, str); SCM_VALIDATE_STRING (1, str);
@ -1172,6 +1172,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
#else #else
/* On e.g. Win32 hosts putenv() called with 'name=' removes the /* On e.g. Win32 hosts putenv() called with 'name=' removes the
environment variable 'name'. */ environment variable 'name'. */
int e;
ptr = scm_malloc (SCM_STRING_LENGTH (str) + 2); ptr = scm_malloc (SCM_STRING_LENGTH (str) + 2);
strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str)); strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str));
ptr[SCM_STRING_LENGTH (str)] = '='; ptr[SCM_STRING_LENGTH (str)] = '=';