Skip to content

Commit

Permalink
* stdlib/setenv.c (__add_to_environ): Revert previous change.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Eggert committed Mar 16, 2015
1 parent a3905fd commit cb21929
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015-03-15 Paul Eggert <eggert@cs.ucla.edu>

* stdlib/setenv.c (__add_to_environ): Revert previous change.

2015-03-14 Andreas Schwab <schwab@linux-m68k.org>

[BZ #18128]
Expand Down
10 changes: 1 addition & 9 deletions stdlib/setenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,8 @@ __add_to_environ (name, value, combined, replace)
{
char **ep;
size_t size;

/* Compute lengths before locking, so that the critical section is
less of a performance bottleneck. VALLEN is needed only if
COMBINED is non-null. Also, testing COMBINED instead of VALUE
causes setenv (..., NULL, ...) to dump core now instead of
corrupting memory later. */
const size_t namelen = strlen (name);
size_t vallen;
if (combined != NULL)
vallen = strlen (value) + 1;
const size_t vallen = value != NULL ? strlen (value) + 1 : 0;

LOCK;

Expand Down

0 comments on commit cb21929

Please sign in to comment.