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