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