diff options
author | 2014-12-10 19:42:14 +0000 | |
---|---|---|
committer | 2014-12-10 19:42:14 +0000 | |
commit | f8e018d72de72c8157e9f53ec0feadc616e07980 (patch) | |
tree | 4c817c65b59fa1948e5701fee98c7ce8d2522976 /usr.sbin/syslogd/syslogd.c | |
parent | File descriptors are of type int, not short. While at it, adjust remaining (diff) | |
download | wireguard-openbsd-f8e018d72de72c8157e9f53ec0feadc616e07980.tar.xz wireguard-openbsd-f8e018d72de72c8157e9f53ec0feadc616e07980.zip |
If default file descriptors (0, 1, 2) have to be assigned to /dev/null,
don't accidentally assign 3, too.
ok millert, with input by and ok bluhm
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index cb6e817c0c6..6458015b6c5 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.135 2014/12/10 19:40:21 tobias Exp $ */ +/* $OpenBSD: syslogd.c,v 1.136 2014/12/10 19:42:14 tobias Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -349,11 +349,11 @@ main(int argc, char *argv[]) if (Debug) setvbuf(stdout, NULL, _IOLBF, 0); - if ((fd = nullfd = open(_PATH_DEVNULL, O_RDWR)) == -1) { + if ((nullfd = open(_PATH_DEVNULL, O_RDWR)) == -1) { logerror("Couldn't open /dev/null"); die(0); } - while (fd++ <= 2) { + for (fd = nullfd + 1; fd <= 2; fd++) { if (fcntl(fd, F_GETFL, 0) == -1) if (dup2(nullfd, fd) == -1) logerror("dup2"); |