diff options
Diffstat (limited to 'src/lib/libc/stdlib/setenv.c')
-rw-r--r-- | src/lib/libc/stdlib/setenv.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c index b6f261e61c..fc7c67a5db 100644 --- a/src/lib/libc/stdlib/setenv.c +++ b/src/lib/libc/stdlib/setenv.c | |||
@@ -32,7 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | static char *rcsid = "$OpenBSD: setenv.c,v 1.3 1998/02/02 22:44:53 millert Exp $"; | 35 | static char *rcsid = "$OpenBSD: setenv.c,v 1.4 2001/07/09 06:57:45 deraadt Exp $"; |
36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
@@ -62,7 +62,8 @@ setenv(name, value, rewrite) | |||
62 | if (!rewrite) | 62 | if (!rewrite) |
63 | return (0); | 63 | return (0); |
64 | if (strlen(C) >= l_value) { /* old larger; copy over */ | 64 | if (strlen(C) >= l_value) { /* old larger; copy over */ |
65 | while (*C++ = *value++); | 65 | while ((*C++ = *value++)) |
66 | ; | ||
66 | return (0); | 67 | return (0); |
67 | } | 68 | } |
68 | } else { /* create new slot */ | 69 | } else { /* create new slot */ |
@@ -95,7 +96,7 @@ setenv(name, value, rewrite) | |||
95 | return (-1); | 96 | return (-1); |
96 | for (C = environ[offset]; (*C = *name++) && *C != '='; ++C) | 97 | for (C = environ[offset]; (*C = *name++) && *C != '='; ++C) |
97 | ; | 98 | ; |
98 | for (*C++ = '='; *C++ = *value++; ) | 99 | for (*C++ = '='; (*C++ = *value++); ) |
99 | ; | 100 | ; |
100 | return (0); | 101 | return (0); |
101 | } | 102 | } |