diff options
author | Daniel Llorens <lloda@sarc.name> | 2021-04-08 20:54:42 +0200 |
---|---|---|
committer | Daniel Llorens <lloda@sarc.name> | 2021-04-08 21:00:42 +0200 |
commit | bdb07f8fc7b37ef64498c7b06cd4457faf456189 (patch) | |
tree | 4c98d2d714f2071513897efe01063bebc36e32cb /lib/putenv.c | |
parent | 88e703084567eb99238a3be6ba4285d87a25eeae (diff) | |
download | guile-bdb07f8fc7b37ef64498c7b06cd4457faf456189.tar.gz |
Update gnulib to a3a946f670718d0dee5a7425ad5ac0a29fb46ea1wip-gnulib-update
This fixes https://lists.gnu.org/archive/html/guile-devel/2021-04/msg00009.html
Diffstat (limited to 'lib/putenv.c')
-rw-r--r-- | lib/putenv.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/putenv.c b/lib/putenv.c index 665efffa0..d342b8153 100644 --- a/lib/putenv.c +++ b/lib/putenv.c @@ -82,15 +82,13 @@ _unsetenv (const char *name) #if HAVE_DECL__PUTENV { - int putenv_result, putenv_errno; + int putenv_result; char *name_ = malloc (len + 2); memcpy (name_, name, len); name_[len] = '='; name_[len + 1] = 0; putenv_result = _putenv (name_); - putenv_errno = errno; free (name_); - __set_errno (putenv_errno); return putenv_result; } #else @@ -144,7 +142,7 @@ putenv (char *string) /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ") to allocate the environ vector and then replace the new entry with "NAME=". */ - int putenv_result, putenv_errno; + int putenv_result; char *name_x = malloc (name_end - string + sizeof "= "); if (!name_x) return -1; @@ -152,7 +150,6 @@ putenv (char *string) name_x[name_end - string + 1] = ' '; name_x[name_end - string + 2] = 0; putenv_result = _putenv (name_x); - putenv_errno = errno; for (ep = environ; *ep; ep++) if (strcmp (*ep, name_x) == 0) { @@ -166,11 +163,10 @@ putenv (char *string) fix that by calling SetEnvironmentVariable directly. */ name_x[name_end - string] = 0; putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1; - putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */ + errno = ENOMEM; /* ENOMEM is the only way to fail. */ } # endif free (name_x); - __set_errno (putenv_errno); return putenv_result; } #else |