Blame SOURCES/at-3.1.12-shell.patch

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