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