aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/cron
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
commit9268022b74279434ed6300244e3f977e56a8ceb5 (patch)
tree377ac0ac449528621eb192cd245adadb5fd53668 /usr.sbin/cron
parent29c34e9d2781cf25403647fb5af7d7ddb23be7e1 (diff)
parent8c3d6a4ab2a4a95d864d9a32d0157d7de90498a4 (diff)
downloadsrc-9268022b74279434ed6300244e3f977e56a8ceb5.tar.gz
src-9268022b74279434ed6300244e3f977e56a8ceb5.zip
Notes
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r--usr.sbin/cron/cron/Makefile2
-rw-r--r--usr.sbin/cron/cron/do_command.c7
-rw-r--r--usr.sbin/cron/crontab/Makefile2
3 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/cron/cron/Makefile b/usr.sbin/cron/cron/Makefile
index c7762f180b64..d9a1d247d41e 100644
--- a/usr.sbin/cron/cron/Makefile
+++ b/usr.sbin/cron/cron/Makefile
@@ -11,6 +11,4 @@ LDADD= ${LIBCRON} ${MINUSLPAM} -lutil
WARNS?= 2
-NO_PIE= yes
-
.include <bsd.prog.mk>
diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c
index fee4131101eb..8dfd4f66aa8f 100644
--- a/usr.sbin/cron/cron/do_command.c
+++ b/usr.sbin/cron/cron/do_command.c
@@ -481,14 +481,17 @@ child_process(e, u)
auto char mailcmd[MAX_COMMAND];
auto char hostname[MAXHOSTNAMELEN];
- (void) gethostname(hostname, MAXHOSTNAMELEN);
+ if (gethostname(hostname, MAXHOSTNAMELEN) == -1)
+ hostname[0] = '\0';
+ hostname[sizeof(hostname) - 1] = '\0';
(void) snprintf(mailcmd, sizeof(mailcmd),
MAILARGS, MAILCMD);
if (!(mail = cron_popen(mailcmd, "w", e))) {
warn("%s", MAILCMD);
(void) _exit(ERROR_EXIT);
}
- fprintf(mail, "From: %s (Cron Daemon)\n", usernm);
+ fprintf(mail, "From: Cron Daemon <%s@%s>\n",
+ usernm, hostname);
fprintf(mail, "To: %s\n", mailto);
fprintf(mail, "Subject: Cron <%s@%s> %s\n",
usernm, first_word(hostname, "."),
diff --git a/usr.sbin/cron/crontab/Makefile b/usr.sbin/cron/crontab/Makefile
index cd9600ae8184..829128e5729e 100644
--- a/usr.sbin/cron/crontab/Makefile
+++ b/usr.sbin/cron/crontab/Makefile
@@ -15,6 +15,4 @@ CFLAGS+= -I${.CURDIR}/../cron
DPADD= ${LIBCRON} ${LIBMD} ${LIBUTIL}
LDADD= ${LIBCRON} -lmd -lutil
-NO_PIE= yes
-
.include <bsd.prog.mk>