Blame SOURCES/at-3.1.20-shell.patch

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