81 lines
2.6 KiB
Diff
81 lines
2.6 KiB
Diff
|
diff -up at-3.1.14/at.1.in.nit at-3.1.14/at.1.in
|
||
|
--- at-3.1.14/at.1.in.nit 2013-09-08 14:43:53.000000000 +0200
|
||
|
+++ at-3.1.14/at.1.in 2013-12-04 11:36:29.737279969 +0100
|
||
|
@@ -204,7 +204,7 @@ queue for
|
||
|
.BR batch .
|
||
|
Queues with higher letters run with increased niceness. The special
|
||
|
queue "=" is reserved for jobs which are currently running.
|
||
|
-.P
|
||
|
+
|
||
|
If a job is submitted to a queue designated with an uppercase letter, the
|
||
|
job is treated as if it were submitted to batch at the time of the job.
|
||
|
Once the time is reached, the batch processing rules with respect to load
|
||
|
diff -up at-3.1.14/atd.c.nit at-3.1.14/atd.c
|
||
|
--- at-3.1.14/atd.c.nit 2013-12-04 11:36:29.733279967 +0100
|
||
|
+++ at-3.1.14/atd.c 2013-12-04 11:38:44.551247496 +0100
|
||
|
@@ -198,6 +198,18 @@ myfork()
|
||
|
|
||
|
#define fork myfork
|
||
|
#endif
|
||
|
+#undef ATD_MAIL_PROGRAM
|
||
|
+#undef ATD_MAIL_NAME
|
||
|
+#if defined(SENDMAIL)
|
||
|
+#define ATD_MAIL_PROGRAM SENDMAIL
|
||
|
+#define ATD_MAIL_NAME "sendmail"
|
||
|
+#elif defined(MAILC)
|
||
|
+#define ATD_MAIL_PROGRAM MAILC
|
||
|
+#define ATD_MAIL_NAME "mail"
|
||
|
+#elif defined(MAILX)
|
||
|
+#define ATD_MAIL_PROGRAM MAILX
|
||
|
+#define ATD_MAIL_NAME "mailx"
|
||
|
+#endif
|
||
|
|
||
|
#ifdef WITH_SELINUX
|
||
|
static int set_selinux_context(const char *name, const char *filename) {
|
||
|
@@ -337,6 +349,9 @@ run_file(const char *filename, uid_t uid
|
||
|
free(newname);
|
||
|
return;
|
||
|
}
|
||
|
+
|
||
|
+ (void) setsid(); /* own session for process */
|
||
|
+
|
||
|
/* Let's see who we mail to. Hopefully, we can read it from
|
||
|
* the command file; if not, send it to the owner, or, failing that,
|
||
|
* to root.
|
||
|
@@ -505,6 +520,9 @@ run_file(const char *filename, uid_t uid
|
||
|
if (setuid(uid) < 0)
|
||
|
perr("Cannot set user id");
|
||
|
|
||
|
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
||
|
+ perr("Cannot reset signal handler to default");
|
||
|
+
|
||
|
chdir("/");
|
||
|
|
||
|
execle("/bin/sh", "sh", (char *) NULL, nenvp);
|
||
|
@@ -570,6 +588,9 @@ run_file(const char *filename, uid_t uid
|
||
|
if (setuid(uid) < 0)
|
||
|
perr("Cannot set user id");
|
||
|
|
||
|
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
||
|
+ perr("Cannot reset signal handler to default");
|
||
|
+
|
||
|
chdir ("/");
|
||
|
|
||
|
#if defined(SENDMAIL)
|
||
|
@@ -697,6 +718,7 @@ run_loop()
|
||
|
* Let's remove the lockfile and reschedule.
|
||
|
*/
|
||
|
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
|
||
|
+ lock_name[sizeof(lock_name)-1] = '\0';
|
||
|
lock_name[0] = '=';
|
||
|
unlink(lock_name);
|
||
|
next_job = now;
|
||
|
@@ -731,6 +753,7 @@ run_loop()
|
||
|
run_batch++;
|
||
|
if (strcmp(batch_name, dirent->d_name) > 0) {
|
||
|
strncpy(batch_name, dirent->d_name, sizeof(batch_name));
|
||
|
+ batch_name[sizeof(batch_name)-1] = '\0';
|
||
|
batch_uid = buf.st_uid;
|
||
|
batch_gid = buf.st_gid;
|
||
|
batch_queue = queue;
|