summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2010-01-10 08:59:20 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2010-01-10 08:59:20 +0000
commit491813702c6c9feb39b78b93e5ed9f1ce44c07f4 (patch)
treecdaf7920e45789507cf6fd7622fb68bd79ad4566 /usr.sbin
parentfce2b1cfa0b07aef6627a0618da0d65ec4f29b7f (diff)
have smtpd errx() at startup if no hostname could be detected either from
a gethostname() call or from a hostname directive in smtpd.conf discussed with jacekm@, i initially intended to only warn but errx seems to be a better solution for now
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/smtpd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 670feb0c199..909ece5200a 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.94 2010/01/03 14:37:37 chl Exp $ */
+/* $OpenBSD: smtpd.c,v 1.95 2010/01/10 08:59:19 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -1014,6 +1014,9 @@ main(int argc, char *argv[])
log_info("startup%s", (debug > 1)?" [debug mode]":"");
+ if (env.sc_hostname[0] == '\0')
+ errx(1, "machine does not have a hostname set");
+
env.stats = mmap(NULL, sizeof(struct stats), PROT_WRITE|PROT_READ,
MAP_ANON|MAP_SHARED, -1, (off_t)0);
if (env.stats == MAP_FAILED)