diff -ur b/at.1.in a/at.1.in --- b/at.1.in 2022-01-29 17:42:19.000000000 +0100 +++ a/at.1.in 2022-02-22 15:19:47.598996428 +0100 @@ -226,7 +226,7 @@ .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 -ur b/atd.c a/atd.c --- b/atd.c 2022-02-22 15:14:02.736336912 +0100 +++ a/atd.c 2022-02-22 15:19:02.163909540 +0100 @@ -197,6 +197,18 @@ #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 @@ -340,6 +352,9 @@ 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. @@ -508,6 +523,9 @@ 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); @@ -573,6 +591,9 @@ 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) @@ -707,6 +728,7 @@ * 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; @@ -741,6 +763,7 @@ 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;