Blame SOURCES/at-3.1.20-shell.patch

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