summaryrefslogtreecommitdiffstats
path: root/usr.bin/limits
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2007-04-30 20:10:10 +0000
committerache <ache@FreeBSD.org>2007-04-30 20:10:10 +0000
commit331b3406526291675183a0c2440abafee7c72220 (patch)
tree513f1f3bf60a5e15d0f671846fe335c5c1dc3a57 /usr.bin/limits
parent55677ed8943c974387273783a1ec5703f250befc (diff)
downloadFreeBSD-src-331b3406526291675183a0c2440abafee7c72220.zip
FreeBSD-src-331b3406526291675183a0c2440abafee7c72220.tar.gz
limits calls setenv("name=value", "value", 1); which violates POSIX:
"The setenv( ) function shall fail if: [EINVAL] The name argument is a null pointer, points to an empty string, or points to a string containing an '=' character." The fix (like all others in this subject) is backward-compatible.
Diffstat (limited to 'usr.bin/limits')
-rw-r--r--usr.bin/limits/limits.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c
index e976f36..854803b 100644
--- a/usr.bin/limits/limits.c
+++ b/usr.bin/limits/limits.c
@@ -399,8 +399,8 @@ 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 && strchr(*argv, '=') != NULL)
+ (void)putenv(strdup(*argv++));
/* Set limits */
for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) {
OpenPOWER on IntegriCloud