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)
Approved by:	re (gjb)
This commit is contained in:
Xin LI 2014-10-02 18:26:40 +00:00
parent c567e60307
commit 8ead5cce9c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=272438

View File

@ -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,8 +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);
}