From d473ca310fb49ab721a415af50950fd2f33c35ee Mon Sep 17 00:00:00 2001 From: delphij Date: Thu, 2 Oct 2014 18:32:30 +0000 Subject: [PATCH] MFC r272288,272289: 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) git-svn-id: svn://svn.freebsd.org/base/stable/8@272440 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.bin/at/at.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index 2fd5e75f0..408679dd9 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -369,6 +369,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++) { @@ -391,8 +392,6 @@ writefile(time_t runtimer, char queue) fputc(*ap, fp); } } - fputs("; export ", fp); - fwrite(*atenv, sizeof(char), eqp-*atenv -1, fp); fputc('\n', fp); } -- 2.45.0