summaryrefslogtreecommitdiff
path: root/usr.bin/limits/limits.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/limits/limits.c')
-rw-r--r--usr.bin/limits/limits.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index e976f369e2ca..0383ac2a1199 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -244,6 +244,7 @@ main(int argc, char *argv[])
int rcswhich, shelltype;
int i, num_limits = 0;
int ch, doeval = 0, doall = 0;
+ int rtrn;
login_cap_t * lc = NULL;
enum { ANY=0, SOFT=1, HARD=2, BOTH=3, DISPLAYONLY=4 } type = ANY;
enum { RCSUNKNOWN=0, RCSSET=1, RCSSEL=2 } todo = RCSUNKNOWN;
@@ -399,8 +400,13 @@ main(int argc, char *argv[])
login_close(lc);
/* set leading environment variables, like eval(1) */
- while (*argv && (p = strchr(*argv, '=')))
- (void)setenv(*argv++, ++p, 1);
+ while (*argv && (p = strchr(*argv, '='))) {
+ *p = '\0';
+ rtrn = setenv(*argv++, p + 1, 1);
+ *p = '=';
+ if (rtrn == -1)
+ err(EXIT_FAILURE, "setenv %s", *argv);
+ }
/* Set limits */
for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {