Blame SOURCES/at-3.1.13-nitpicks.patch

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