Browse Source

Make unsetenv(NULL) and unsetenv("") give EINVAL, per POSIX. ok deraadt@

OPENBSD_4_8
naddy 14 years ago
parent
commit
55ff65210b
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/lib/libc/stdlib/setenv.c

+ 5
- 1
src/lib/libc/stdlib/setenv.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: setenv.c,v 1.11 2009/06/04 20:39:13 millert Exp $ */
/* $OpenBSD: setenv.c,v 1.12 2010/06/29 04:09:34 naddy Exp $ */
/* /*
* Copyright (c) 1987 Regents of the University of California. * Copyright (c) 1987 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -145,6 +145,10 @@ unsetenv(const char *name)
const char *np; const char *np;
int offset; int offset;
if (!name || !*name) {
errno = EINVAL;
return (-1);
}
for (np = name; *np && *np != '='; ++np) for (np = name; *np && *np != '='; ++np)
; ;
if (*np) { if (*np) {


Loading…
Cancel
Save