summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2001-12-30 00:27:14 +0000
committerderaadt <deraadt@openbsd.org>2001-12-30 00:27:14 +0000
commit93f5693380a1a12e2e68e4a05588f957581d3f1a (patch)
tree6c1ef2b48658e9c8b496c941d222a1532d7292c5
parentCollapse two if statements into one (introduced in previous commit) (diff)
downloadwireguard-openbsd-93f5693380a1a12e2e68e4a05588f957581d3f1a.tar.xz
wireguard-openbsd-93f5693380a1a12e2e68e4a05588f957581d3f1a.zip
setup stdout & stderr; marius@alchemy.franken.de
-rw-r--r--libexec/smtpd/src/smtpfwdd.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/libexec/smtpd/src/smtpfwdd.c b/libexec/smtpd/src/smtpfwdd.c
index 2fcc3e26ac6..9b08f77e52d 100644
--- a/libexec/smtpd/src/smtpfwdd.c
+++ b/libexec/smtpd/src/smtpfwdd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpfwdd.c,v 1.7 2001/08/23 14:17:08 aaron Exp $*/
+/* $OpenBSD: smtpfwdd.c,v 1.8 2001/12/30 00:27:14 deraadt Exp $*/
/*
* smtpfwdd, Obtuse SMTP forward daemon, master process watches spool
@@ -42,7 +42,7 @@
*/
char *obtuse_copyright =
"Copyright 1996 - Obtuse Systems Corporation - All rights reserved.";
-char *obtuse_rcsid = "$OpenBSD: smtpfwdd.c,v 1.7 2001/08/23 14:17:08 aaron Exp $";
+char *obtuse_rcsid = "$OpenBSD: smtpfwdd.c,v 1.8 2001/12/30 00:27:14 deraadt Exp $";
#include <stdio.h>
#include <signal.h>
@@ -646,6 +646,19 @@ forward(char *fname)
exit(EX_OSERR);
}
+ /*
+ * Open /dev/null as stdout and as stderr so sendmail 8.12.1 (and
+ * above ?) won't complain about missing file descriptors.
+ */
+ if (open("/dev/null", O_WRONLY | O_APPEND) < 0) {
+ syslog(LOG_ERR, "Couldn't open /dev/null as stdout (%m)");
+ exit (EX_OSERR);
+ }
+ if (open("/dev/null", O_RDWR | O_APPEND) < 0) {
+ syslog(LOG_ERR, "Couldn't open /dev/null as stderr (%m)");
+ exit (EX_OSERR);
+ }
+
fclose(f);
closelog();
if (lseek(0, body, SEEK_SET) < 0) {