Blame SOURCES/at-3.1.20-shell.patch

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