Blame SOURCES/at-3.1.13-nitpicks.patch

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