diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-09-26 17:15:20 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-09-26 17:15:20 +0000 |
commit | c73fd5e91d5d2babf7686bcd85129e8c39d013d7 (patch) | |
tree | cd17be2ac2c42517b5bd49a399076cc6226ad298 /usr.sbin/rtadvd | |
parent | 36d505fc2640685c8a23a3dd419712eb1dcbe270 (diff) |
Exit early from rdaemon() is the passed fd is invalid.
fd == -1 check suggested by deraadt@, ok florian@
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 84c811abee4..990d9785c2d 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtadvd.c,v 1.81 2016/09/21 18:54:24 jca Exp $ */ +/* $OpenBSD: rtadvd.c,v 1.82 2016/09/26 17:15:19 jca Exp $ */ /* $KAME: rtadvd.c,v 1.66 2002/05/29 14:18:36 itojun Exp $ */ /* @@ -1320,6 +1320,12 @@ ra_timer_update(struct rainfo *rai) int rdaemon(int devnull) { + if (devnull == -1) { + errno = EBADF; + return (-1); + } + if (fcntl(devnull, F_GETFL) == -1) + return (-1); switch (fork()) { case -1: |