56 lines
1.6 KiB
Diff
56 lines
1.6 KiB
Diff
|
diff -up at-3.1.12/at.c.shell at-3.1.12/at.c
|
||
|
--- at-3.1.12/at.c.shell 2009-12-02 13:25:12.706989310 +0100
|
||
|
+++ at-3.1.12/at.c 2009-12-02 13:26:01.991966200 +0100
|
||
|
@@ -62,11 +62,8 @@
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
-#ifdef TM_IN_SYS_TIME
|
||
|
#include <sys/time.h>
|
||
|
-#else
|
||
|
#include <time.h>
|
||
|
-#endif
|
||
|
|
||
|
#ifdef HAVE_UNISTD_H
|
||
|
#include <unistd.h>
|
||
|
@@ -244,6 +241,12 @@ writefile(time_t runtimer, char queue)
|
||
|
int kill_errno;
|
||
|
int rc;
|
||
|
int mailsize = 128;
|
||
|
+ struct timeval tv;
|
||
|
+ struct timezone tz;
|
||
|
+ long int i;
|
||
|
+
|
||
|
+ gettimeofday(&tv, &tz);
|
||
|
+ srandom(getpid()+tv.tv_usec);
|
||
|
|
||
|
/* Install the signal handler for SIGINT; terminate after removing the
|
||
|
* spool file if necessary
|
||
|
@@ -461,6 +464,9 @@ writefile(time_t runtimer, char queue)
|
||
|
fprintf(fp, " || {\n\t echo 'Execution directory "
|
||
|
"inaccessible' >&2\n\t exit 1\n}\n");
|
||
|
|
||
|
+ i = random();
|
||
|
+ fprintf(fp, "${SHELL:-/bin/sh} << marcinDELIMITER%08lx\n", i);
|
||
|
+
|
||
|
istty = isatty(fileno(stdin));
|
||
|
if (istty) {
|
||
|
fprintf(stderr, "at> ");
|
||
|
@@ -477,6 +483,7 @@ writefile(time_t runtimer, char queue)
|
||
|
fprintf(stderr, "<EOT>\n");
|
||
|
}
|
||
|
fprintf(fp, "\n");
|
||
|
+ fprintf(fp, "marcinDELIMITER%08lx\n", i);
|
||
|
if (ferror(fp))
|
||
|
panic("Output error");
|
||
|
|
||
|
@@ -926,7 +933,7 @@ main(int argc, char **argv)
|
||
|
It also alows a warning diagnostic to be printed. Because of the
|
||
|
possible variance, we always output the diagnostic. */
|
||
|
|
||
|
- fprintf(stderr, "warning: commands will be executed using /bin/sh\n");
|
||
|
+ //fprintf(stderr, "warning: commands will be executed using /bin/sh\n");
|
||
|
|
||
|
writefile(timer, queue);
|
||
|
break;
|