Blame SOURCES/at-3.1.13-nitpicks.patch

973edf
diff -up at-3.1.13/at.1.in.nit at-3.1.13/at.1.in
973edf
--- at-3.1.13/at.1.in.nit	2011-06-25 14:43:14.000000000 +0200
973edf
+++ at-3.1.13/at.1.in	2011-07-28 13:04:41.398174737 +0200
973edf
@@ -126,7 +126,7 @@ and to run a job at 1am tomorrow, you wo
973edf
 .B at 1am tomorrow.
973edf
 .PP
973edf
 The definition of the time specification can be found in
973edf
-.IR @prefix@/share/doc/at/timespec .
973edf
+.IR @prefix@/share/doc/at-@VERSION@/timespec .
973edf
 .PP
973edf
 For both
973edf
 .BR at " and " batch ,
973edf
@@ -204,7 +204,7 @@ queue for
973edf
 .BR batch .
973edf
 Queues with higher letters run with increased niceness.  The special
973edf
 queue "=" is reserved for jobs which are currently running.
973edf
-.P
973edf
+
973edf
 If a job is submitted to a queue designated with an uppercase letter, the
973edf
 job is treated as if it were submitted to batch at the time of the job.
973edf
 Once the time is reached, the batch processing rules with respect to load
973edf
@@ -248,7 +248,7 @@ is an alias for
973edf
 .TP
973edf
 .B \-v
973edf
 Shows the time the job will be executed before reading the job.
973edf
-.P
973edf
+
973edf
 Times displayed will be in the format "Thu Feb 20 14:50:00 1997".
973edf
 .TP
973edf
 .B
973edf
diff -up at-3.1.13/atd.c.nit at-3.1.13/atd.c
973edf
--- at-3.1.13/atd.c.nit	2011-06-25 14:43:14.000000000 +0200
973edf
+++ at-3.1.13/atd.c	2011-07-28 13:01:31.577967025 +0200
973edf
@@ -83,6 +83,9 @@
973edf
 #include "getloadavg.h"
973edf
 #endif
973edf
 
973edf
+#ifndef LOG_ATD
973edf
+#define LOG_ATD        LOG_DAEMON
973edf
+#endif
973edf
 /* Macros */
973edf
 
973edf
 #define BATCH_INTERVAL_DEFAULT 60
973edf
@@ -194,6 +197,18 @@ myfork()
973edf
 
973edf
 #define fork myfork
973edf
 #endif
973edf
+#undef ATD_MAIL_PROGRAM
973edf
+#undef ATD_MAIL_NAME
973edf
+#if defined(SENDMAIL)
973edf
+#define ATD_MAIL_PROGRAM SENDMAIL
973edf
+#define ATD_MAIL_NAME    "sendmail"
973edf
+#elif  defined(MAILC)
973edf
+#define ATD_MAIL_PROGRAM MAILC
973edf
+#define ATD_MAIL_NAME    "mail"
973edf
+#elif  defined(MAILX)
973edf
+#define ATD_MAIL_PROGRAM MAILX
973edf
+#define ATD_MAIL_NAME    "mailx"
973edf
+#endif
973edf
 
973edf
 static void
973edf
 run_file(const char *filename, uid_t uid, gid_t gid)
973edf
@@ -271,6 +286,9 @@ run_file(const char *filename, uid_t uid
973edf
 	free(newname);
973edf
 	return;
973edf
     }
973edf
+
973edf
+    (void) setsid(); //own session for process
973edf
+
973edf
     /* Let's see who we mail to.  Hopefully, we can read it from
973edf
      * the command file; if not, send it to the owner, or, failing that,
973edf
      * to root.
973edf
@@ -433,6 +451,9 @@ run_file(const char *filename, uid_t uid
973edf
 	    if (setuid(uid) < 0)
973edf
 		perr("Cannot set user id");
973edf
 
973edf
+	    if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
973edf
+		perr("Cannot reset signal handler to default");
973edf
+
973edf
 	    chdir("/");
973edf
 
973edf
 	    if (execle("/bin/sh", "sh", (char *) NULL, nenvp) != 0)
973edf
@@ -501,6 +522,9 @@ run_file(const char *filename, uid_t uid
973edf
 	    if (setuid(uid) < 0)
973edf
 		perr("Cannot set user id");
973edf
 
973edf
+	    if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
973edf
+		perr("Cannot reset signal handler to default");
973edf
+
973edf
 	    chdir ("/");
973edf
 
973edf
 #if defined(SENDMAIL)
973edf
@@ -615,6 +639,7 @@ run_loop()
973edf
 		 * Let's remove the lockfile and reschedule.
973edf
 		 */
973edf
 		strncpy(lock_name, dirent->d_name, sizeof(lock_name));
973edf
+		lock_name[sizeof(lock_name)-1] = '\0';
973edf
 		lock_name[0] = '=';
973edf
 		unlink(lock_name);
973edf
 		next_job = now;
973edf
@@ -649,6 +674,7 @@ run_loop()
973edf
 	    run_batch++;
973edf
 	    if (strcmp(batch_name, dirent->d_name) > 0) {
973edf
 		strncpy(batch_name, dirent->d_name, sizeof(batch_name));
973edf
+		batch_name[sizeof(batch_name)-1] = '\0';
973edf
 		batch_uid = buf.st_uid;
973edf
 		batch_gid = buf.st_gid;
973edf
 		batch_queue = queue;
973edf
@@ -723,11 +749,7 @@ main(int argc, char *argv[])
973edf
 
973edf
     RELINQUISH_PRIVS_ROOT(daemon_uid, daemon_gid)
973edf
 
973edf
-#ifndef LOG_CRON
973edf
-#define LOG_CRON	LOG_DAEMON
973edf
-#endif
973edf
-
973edf
-    openlog("atd", LOG_PID, LOG_CRON);
973edf
+    openlog("atd", LOG_PID, LOG_ATD);
973edf
 
973edf
     opterr = 0;
973edf
     errno = 0;