|
|
d83c6e |
diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
|
|
|
d83c6e |
--- at-3.1.14/atd.c.mail 2013-12-04 11:39:44.556239282 +0100
|
|
|
d83c6e |
+++ at-3.1.14/atd.c 2013-12-04 11:40:50.544234246 +0100
|
|
|
d83c6e |
@@ -100,6 +100,10 @@ int selinux_enabled=0;
|
|
|
d83c6e |
#define BATCH_INTERVAL_DEFAULT 60
|
|
|
d83c6e |
#define CHECK_INTERVAL 3600
|
|
|
d83c6e |
|
|
|
d83c6e |
+#ifndef MAXHOSTNAMELEN
|
|
|
d83c6e |
+#define MAXHOSTNAMELEN 64
|
|
|
d83c6e |
+#endif
|
|
|
d83c6e |
+
|
|
|
d83c6e |
/* Global variables */
|
|
|
d83c6e |
|
|
|
d83c6e |
uid_t real_uid, effective_uid;
|
|
|
d83c6e |
@@ -117,6 +121,7 @@ static time_t last_chg;
|
|
|
d83c6e |
static int nothing_to_do;
|
|
|
d83c6e |
unsigned int batch_interval;
|
|
|
d83c6e |
static int run_as_daemon = 0;
|
|
|
d83c6e |
+static int mail_with_hostname = 0;
|
|
|
d83c6e |
|
|
|
d83c6e |
static volatile sig_atomic_t term_signal = 0;
|
|
|
d83c6e |
|
|
|
d83c6e |
@@ -298,6 +303,7 @@ run_file(const char *filename, uid_t uid
|
|
|
d83c6e |
char fmt[64];
|
|
|
d83c6e |
unsigned long jobno;
|
|
|
d83c6e |
int rc;
|
|
|
d83c6e |
+ char hostbuf[MAXHOSTNAMELEN];
|
|
|
d83c6e |
#ifdef WITH_PAM
|
|
|
d83c6e |
int retcode;
|
|
|
d83c6e |
#endif
|
|
|
d83c6e |
@@ -452,6 +458,11 @@ run_file(const char *filename, uid_t uid
|
|
|
d83c6e |
|
|
|
d83c6e |
write_string(fd_out, "Subject: Output from your job ");
|
|
|
d83c6e |
write_string(fd_out, jobbuf);
|
|
|
d83c6e |
+ if (mail_with_hostname > 0) {
|
|
|
d83c6e |
+ gethostname(hostbuf, MAXHOSTNAMELEN-1);
|
|
|
d83c6e |
+ write_string(fd_out, " ");
|
|
|
d83c6e |
+ write_string(fd_out, hostbuf);
|
|
|
d83c6e |
+ }
|
|
|
d83c6e |
write_string(fd_out, "\nTo: ");
|
|
|
d83c6e |
write_string(fd_out, mailname);
|
|
|
d83c6e |
write_string(fd_out, "\n\n");
|
|
|
d83c6e |
@@ -843,7 +854,7 @@ main(int argc, char *argv[])
|
|
|
d83c6e |
run_as_daemon = 1;
|
|
|
d83c6e |
batch_interval = BATCH_INTERVAL_DEFAULT;
|
|
|
d83c6e |
|
|
|
d83c6e |
- while ((c = getopt(argc, argv, "sdl:b:f")) != EOF) {
|
|
|
d83c6e |
+ while ((c = getopt(argc, argv, "sdnl:b:f")) != EOF) {
|
|
|
d83c6e |
switch (c) {
|
|
|
d83c6e |
case 'l':
|
|
|
d83c6e |
if (sscanf(optarg, "%lf", &load_avg) != 1)
|
|
|
d83c6e |
@@ -865,6 +876,10 @@ main(int argc, char *argv[])
|
|
|
d83c6e |
daemon_foreground++;
|
|
|
d83c6e |
break;
|
|
|
d83c6e |
|
|
|
d83c6e |
+ case 'n':
|
|
|
d83c6e |
+ mail_with_hostname=1;
|
|
|
d83c6e |
+ break;
|
|
|
d83c6e |
+
|
|
|
d83c6e |
case 's':
|
|
|
d83c6e |
run_as_daemon = 0;
|
|
|
d83c6e |
break;
|