int ch;
mode_t cmask;
struct flock lock;
+ char * oldpwd_str = NULL;
#ifdef __FreeBSD__
(void) setlocale(LC_TIME, "");
else
{
size_t i;
- for (i=0; i<sizeof(no_export)/sizeof(no_export[0]); i++)
- {
- export = export
- && (strncmp(*atenv, no_export[i],
+
+ if(strncmp(*atenv, "OLDPWD", (size_t) (eqp-*atenv)) == 0) {
+ oldpwd_str = *atenv;
+ }
+ if (!posixly_correct) {
+ /* Test 891 expects TERM, etc. to show up in "at" env
+ so exclude them only when not posixly_correct */
+ for (i=0; i<sizeof(no_export)/sizeof(no_export[0]); i++)
+ {
+ export = export
+ && (strncmp(*atenv, no_export[i],
(size_t) (eqp-*atenv)) != 0);
+ }
}
eqp++;
}
fprintf(fp, " || {\n\t echo 'Execution directory "
"inaccessible' >&2\n\t exit 1\n}\n");
+ /* Put OLDPWD back, since the cd has set it */
+ /* Although this is added to fix conformance test at.ex 891, it seems like */
+ /* the right thing to do always, so the code is not posix_pedantic only */
+ if (oldpwd_str) {
+ fprintf(fp, "%s; export OLDPWD\n", oldpwd_str);
+ } else {
+ fprintf(fp, "unset OLDPWD\n");
+ }
+
while((ch = getchar()) != EOF)
fputc(ch, fp);
timer = -1;
RELINQUISH_PRIVS
+ if (argv[0] == NULL)
+ usage();
/* Eat any leading paths
*/
if ((pgm = strrchr(argv[0], '/')) == NULL)