summaryrefslogtreecommitdiff
path: root/usr.bin/at/at.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2014-09-29 18:44:50 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2014-09-29 18:44:50 +0000
commit07dc3e8c51aefb18a115b3fbd878da9a9d4e68d1 (patch)
tree3008ea9f132f02d321cae3bf6588d9eabf6db399 /usr.bin/at/at.c
parent6c17b9adb48951c54dcd842bcd3581eaf8011954 (diff)
When setting environment variables in the atrun script, use the
"export foo=bar" form instead of "foo=bar; export foo" since the former allows the shell to catch variable names that are not valid shell identifiers. This will cause /bin/sh to exit with an error (which gets mailed to the at user) and it will not run the script. OK miod@
Diffstat (limited to 'usr.bin/at/at.c')
-rw-r--r--usr.bin/at/at.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index f1ce091a945..63727c1ec43 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.62 2013/11/25 18:02:50 deraadt Exp $ */
+/* $OpenBSD: at.c,v 1.63 2014/09/29 18:44:49 millert Exp $ */
/*
* at.c : Put file into atrun queue
@@ -319,6 +319,7 @@ writefile(const char *cwd, time_t runtimer, char queue)
}
if (export) {
+ (void)fputs("export ", fp);
(void)fwrite(*atenv, sizeof(char), eqp - *atenv, fp);
for (ap = eqp; *ap != '\0'; ap++) {
if (*ap == '\n')
@@ -340,8 +341,6 @@ writefile(const char *cwd, time_t runtimer, char queue)
(void)fputc(*ap, fp);
}
}
- (void)fputs("; export ", fp);
- (void)fwrite(*atenv, sizeof(char), eqp - *atenv - 1, fp);
(void)fputc('\n', fp);
}
}