From da9c3bbbeecad41ea804d803c625e7e0e65448ad Mon Sep 17 00:00:00 2001 From: Xin LI Date: Mon, 29 Sep 2014 21:45:57 +0000 Subject: [PATCH] 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. Obtained from: OpenBSD (r1.63 millert) MFC after: 3 days --- usr.bin/at/at.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index 5f4500ba343b..18367dd1372e 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -367,6 +367,7 @@ writefile(time_t runtimer, char queue) if (export) { + (void)fputs("export ", fp); fwrite(*atenv, sizeof(char), eqp-*atenv, fp); for(ap = eqp;*ap != '\0'; ap++) { @@ -389,7 +390,6 @@ writefile(time_t runtimer, char queue) fputc(*ap, fp); } } - fputs("; export ", fp); fwrite(*atenv, sizeof(char), eqp-*atenv -1, fp); fputc('\n', fp);