Blame SOURCES/at-3.1.12-shell.patch

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