This repository has been archived on 2026-01-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
anacron/anacron-2.3-hostname.patch
2006-10-10 13:58:59 +00:00

44 lines
1.1 KiB
Diff

--- anacron-2.3/runjob.c.hostname 2006-10-04 11:58:55.000000000 +0200
+++ anacron-2.3/runjob.c 2006-10-09 09:43:23.000000000 +0200
@@ -94,6 +94,17 @@
}
static char *
+hostname()
+{
+ char hostname[MAXHOSTNAME];
+
+ if (gethostname(hostname, MAXHOSTNAME) == 0)
+ return hostname;
+ else
+ die_e("Can't resolve hostname");
+}
+
+static char *
mailto()
{
char *alias;
@@ -255,9 +266,11 @@
xwrite(fd, "Content-Type: text/plain; charset=\"");
xwrite(fd, nl_langinfo(CODESET));
xwrite(fd, "\"\n");
- xwrite(fd, "Subject: Anacron job '");
+ xwrite(fd, "Subject: Anacron job for '");
+ xwrite(fd, hostname());
+ xwrite(fd, "' ");
xwrite(fd, jr->ident);
- xwrite(fd, "'\n\n");
+ xwrite(fd, "\n");
jr->mail_header_size = file_size(fd);
pid = xfork();
--- anacron-2.3/global.h.hostname 2006-10-04 11:58:55.000000000 +0200
+++ anacron-2.3/global.h 2006-10-04 11:58:55.000000000 +0200
@@ -33,6 +33,7 @@
/* Mail interface. (All MTAs should supply this command) */
#define SENDMAIL "/usr/sbin/sendmail"
+#define MAXHOSTNAME 64
#ifndef PID_FILE
#define PID_FILE "/var/run/anacron.pid"