6927e7
diff -up at-3.1.20/at.c.shell at-3.1.20/at.c
6927e7
--- at-3.1.20/at.c.shell	2016-07-01 09:47:13.392684445 +0200
6927e7
+++ at-3.1.20/at.c	2016-07-01 09:48:47.679931959 +0200
6927e7
@@ -62,11 +62,8 @@
6927e7
 #include <stdlib.h>
6927e7
 #include <string.h>
6927e7
 
6927e7
-#ifdef TM_IN_SYS_TIME
6927e7
 #include <sys/time.h>
6927e7
-#else
6927e7
 #include <time.h>
6927e7
-#endif
6927e7
 
6927e7
 #ifdef HAVE_UNISTD_H
6927e7
 #include <unistd.h>
6927e7
@@ -239,6 +236,12 @@ writefile(time_t runtimer, char queue)
6927e7
     int kill_errno;
6927e7
     int rc;
6927e7
     int mailsize = 128;
6927e7
+    struct timeval tv;
6927e7
+    struct timezone tz;
6927e7
+    long int i;
6927e7
+
6927e7
+    gettimeofday(&tv, &tz;;
6927e7
+    srandom(getpid()+tv.tv_usec);
6927e7
 
6927e7
 /* Install the signal handler for SIGINT; terminate after removing the
6927e7
  * spool file if necessary
6927e7
@@ -465,6 +468,9 @@ writefile(time_t runtimer, char queue)
6927e7
     fprintf(fp, " || {\n\t echo 'Execution directory "
6927e7
 	    "inaccessible' >&2\n\t exit 1\n}\n");
6927e7
 
6927e7
+    i = random();
6927e7
+    fprintf(fp, "${SHELL:-/bin/sh} << \'marcinDELIMITER%08lx\'\n", i);
6927e7
+
6927e7
     istty = isatty(fileno(stdin));
6927e7
     if (istty) {
6927e7
 	fprintf(stderr, "at> ");
6927e7
@@ -480,7 +486,7 @@ writefile(time_t runtimer, char queue)
6927e7
     if (istty) {
6927e7
 	fprintf(stderr, "<EOT>\n");
6927e7
     }
6927e7
-    fprintf(fp, "\n");
cdb070
+    fprintf(fp, "\nmarcinDELIMITER%08lx\n", i);
6927e7
     if (ferror(fp))
6927e7
 	panic("Output error");
6927e7
     fflush(fp);