Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* stdlib/setenv.c (unsetenv): Don't search environment if it does
	not exist.
  • Loading branch information
Ulrich Drepper committed Dec 2, 2008
1 parent 37a6a27 commit 1fa7ae0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2008-12-01 Ulrich Drepper <drepper@redhat.com>

* stdlib/setenv.c (unsetenv): Don't search environment if it does
not exist.

2008-11-29 Ulrich Drepper <drepper@redhat.com>

* login/utmp_file.c (file_writable): New variable.
Expand Down
29 changes: 15 additions & 14 deletions stdlib/setenv.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1992,1995-2001,2004 Free Software Foundation, Inc.
/* Copyright (C) 1992,1995-2001,2004, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -292,19 +292,20 @@ unsetenv (name)
LOCK;

ep = __environ;
while (*ep != NULL)
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
{
/* Found it. Remove this pointer by moving later ones back. */
char **dp = ep;

do
dp[0] = dp[1];
while (*dp++);
/* Continue the loop in case NAME appears again. */
}
else
++ep;
if (ep != NULL)
while (*ep != NULL)
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
{
/* Found it. Remove this pointer by moving later ones back. */
char **dp = ep;

do
dp[0] = dp[1];
while (*dp++);
/* Continue the loop in case NAME appears again. */
}
else
++ep;

UNLOCK;

Expand Down

0 comments on commit 1fa7ae0

Please sign in to comment.