aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorThomas Quinot <thomas@FreeBSD.org>2003-02-10 11:20:58 +0000
committerThomas Quinot <thomas@FreeBSD.org>2003-02-10 11:20:58 +0000
commit6ced08bfa6bc773baae5d299e6161972f9a33fef (patch)
tree6eaf7787c0804164bcd7066c74914a16a4dbcca5 /usr.sbin
parent4e44912c6c8f199db5f741b851854e31767b5027 (diff)
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/cron/lib/env.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/usr.sbin/cron/lib/env.c b/usr.sbin/cron/lib/env.c
index c2adb49bb2dff..fd358176b1249 100644
--- a/usr.sbin/cron/lib/env.c
+++ b/usr.sbin/cron/lib/env.c
@@ -193,14 +193,16 @@ load_env(envstr, f)
break;
}
} else {
- if (isspace (*c)) {
- state++;
- c++;
- break;
- }
- if (state == NAME && *c == '=') {
- state++;
- break;
+ if (state == NAME) {
+ if (isspace (*c)) {
+ c++;
+ state++;
+ break;
+ }
+ if (*c == '=') {
+ state++;
+ break;
+ }
}
}
*str++ = *c++;
@@ -232,9 +234,14 @@ load_env(envstr, f)
Set_LineNum(fileline);
return (FALSE);
}
+ if (state == VALUE) {
+ /* End of unquoted value: trim trailing whitespace */
+ c = val + strlen (val);
+ while (c > val && isspace (*(c - 1)))
+ *(--c) = '\0';
+ }
- /* 2 fields from parser; looks like an env setting
- */
+ /* 2 fields from parser; looks like an env setting */
if (strlen(name) + 1 + strlen(val) >= MAX_ENVSTR-1)
return (FALSE);