Blame SOURCES/at-3.1.18-nitpicks.patch

d83c6e
diff -up at-3.1.18/atd.c.nit at-3.1.18/atd.c
d83c6e
--- at-3.1.18/atd.c.nit	2016-03-23 12:46:49.222277787 +0100
d83c6e
+++ at-3.1.18/atd.c	2016-03-23 12:47:50.521639804 +0100
d83c6e
@@ -196,6 +196,18 @@ myfork()
d83c6e
 
d83c6e
 #define fork myfork
d83c6e
 #endif
d83c6e
+#undef ATD_MAIL_PROGRAM
d83c6e
+#undef ATD_MAIL_NAME
d83c6e
+#if defined(SENDMAIL)
d83c6e
+#define ATD_MAIL_PROGRAM SENDMAIL
d83c6e
+#define ATD_MAIL_NAME    "sendmail"
d83c6e
+#elif  defined(MAILC)
d83c6e
+#define ATD_MAIL_PROGRAM MAILC
d83c6e
+#define ATD_MAIL_NAME    "mail"
d83c6e
+#elif  defined(MAILX)
d83c6e
+#define ATD_MAIL_PROGRAM MAILX
d83c6e
+#define ATD_MAIL_NAME    "mailx"
d83c6e
+#endif
d83c6e
 
d83c6e
 #ifdef WITH_SELINUX
d83c6e
 static int
d83c6e
@@ -339,6 +351,9 @@ run_file(const char *filename, uid_t uid
d83c6e
 	free(newname);
d83c6e
 	return;
d83c6e
     }
d83c6e
+
d83c6e
+    (void) setsid(); /* own session for process */
d83c6e
+
d83c6e
     /* Let's see who we mail to.  Hopefully, we can read it from
d83c6e
      * the command file; if not, send it to the owner, or, failing that,
d83c6e
      * to root.
d83c6e
@@ -507,6 +522,9 @@ run_file(const char *filename, uid_t uid
d83c6e
 	    if (setuid(uid) < 0)
d83c6e
 		perr("Cannot set user id");
d83c6e
 
d83c6e
+	    if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
d83c6e
+		perr("Cannot reset signal handler to default");
d83c6e
+
d83c6e
 	    chdir("/");
d83c6e
 
d83c6e
 	    execle("/bin/sh", "sh", (char *) NULL, nenvp);
d83c6e
@@ -572,6 +590,9 @@ run_file(const char *filename, uid_t uid
d83c6e
 	    if (setuid(uid) < 0)
d83c6e
 		perr("Cannot set user id");
d83c6e
 
d83c6e
+	    if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
d83c6e
+		perr("Cannot reset signal handler to default");
d83c6e
+
d83c6e
 	    chdir ("/");
d83c6e
 
d83c6e
 #if defined(SENDMAIL)
d83c6e
@@ -699,6 +720,7 @@ run_loop()
d83c6e
 		 * Let's remove the lockfile and reschedule.
d83c6e
 		 */
d83c6e
 		strncpy(lock_name, dirent->d_name, sizeof(lock_name));
d83c6e
+		lock_name[sizeof(lock_name)-1] = '\0';
d83c6e
 		lock_name[0] = '=';
d83c6e
 		unlink(lock_name);
d83c6e
 		next_job = now;
d83c6e
@@ -733,6 +755,7 @@ run_loop()
d83c6e
 	    run_batch++;
d83c6e
 	    if (strcmp(batch_name, dirent->d_name) > 0) {
d83c6e
 		strncpy(batch_name, dirent->d_name, sizeof(batch_name));
d83c6e
+		batch_name[sizeof(batch_name)-1] = '\0';
d83c6e
 		batch_uid = buf.st_uid;
d83c6e
 		batch_gid = buf.st_gid;
d83c6e
 		batch_queue = queue;
d83c6e
diff -up at-3.1.18/at.1.in.nit at-3.1.18/at.1.in
d83c6e
--- at-3.1.18/at.1.in.nit	2015-12-06 16:45:10.000000000 +0100
d83c6e
+++ at-3.1.18/at.1.in	2016-03-23 12:46:49.226277876 +0100
d83c6e
@@ -210,7 +210,7 @@ queue for
d83c6e
 .BR batch .
d83c6e
 Queues with higher letters run with increased niceness.  The special
d83c6e
 queue "=" is reserved for jobs which are currently running.
d83c6e
-.P
d83c6e
+
d83c6e
 If a job is submitted to a queue designated with an uppercase letter, the
d83c6e
 job is treated as if it were submitted to batch at the time of the job.
d83c6e
 Once the time is reached, the batch processing rules with respect to load