summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/setenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/setenv.c')
-rw-r--r--src/lib/libc/stdlib/setenv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c
index 089ab92d38..9060fdba88 100644
--- a/src/lib/libc/stdlib/setenv.c
+++ b/src/lib/libc/stdlib/setenv.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: setenv.c,v 1.13 2010/08/23 22:31:50 millert Exp $ */ 1/* $OpenBSD: setenv.c,v 1.14 2012/09/23 16:08:04 jeremy Exp $ */
2/* 2/*
3 * Copyright (c) 1987 Regents of the University of California. 3 * Copyright (c) 1987 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -94,14 +94,16 @@ setenv(const char *name, const char *value, int rewrite)
94 const char *np; 94 const char *np;
95 int l_value, offset = 0; 95 int l_value, offset = 0;
96 96
97 if (!name || !*name) {
98 errno = EINVAL;
99 return (-1);
100 }
97 for (np = name; *np && *np != '='; ++np) 101 for (np = name; *np && *np != '='; ++np)
98 ; 102 ;
99#ifdef notyet
100 if (*np) { 103 if (*np) {
101 errno = EINVAL; 104 errno = EINVAL;
102 return (-1); /* has `=' in name */ 105 return (-1); /* has `=' in name */
103 } 106 }
104#endif
105 107
106 l_value = strlen(value); 108 l_value = strlen(value);
107 if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) { 109 if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) {