diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-04-04 17:24:51 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-04-04 17:24:51 +0000 |
commit | 4a3b8a7829c4bd197aff4c0cd80cc2e9ed848c5c (patch) | |
tree | 09dcc08230f0b1a68bd6e4cf8653a3de00ae1337 | |
parent | d0ebd0cc207709d8141e262402d39e9467d3f10c (diff) |
Return an error much earlier if recvmsg fails
-rw-r--r-- | libexec/ftpd/monitor_fdpass.c | 6 | ||||
-rw-r--r-- | sbin/pflogd/privsep_fdpass.c | 6 | ||||
-rw-r--r-- | usr.sbin/syslogd/privsep_fdpass.c | 6 | ||||
-rw-r--r-- | usr.sbin/tcpdump/privsep_fdpass.c | 6 |
4 files changed, 16 insertions, 8 deletions
diff --git a/libexec/ftpd/monitor_fdpass.c b/libexec/ftpd/monitor_fdpass.c index f4923a1267a..2090d22cb2c 100644 --- a/libexec/ftpd/monitor_fdpass.c +++ b/libexec/ftpd/monitor_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_fdpass.c,v 1.4 2008/03/24 16:11:00 deraadt Exp $ */ +/* $OpenBSD: monitor_fdpass.c,v 1.5 2012/04/04 17:24:49 deraadt Exp $ */ /* * Copyright (c) 2002 Matthieu Herrb @@ -87,8 +87,10 @@ recv_fd(int sock) msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); - if ((n = recvmsg(sock, &msg, 0)) == -1) + if ((n = recvmsg(sock, &msg, 0)) == -1) { syslog(LOG_WARNING, "recv_fd: recvmsg(%d): %m", sock); + return -1; + } if (n != sizeof(int)) syslog(LOG_WARNING, "recv_fd: recvmsg: expected received 1 got %ld", (long)n); diff --git a/sbin/pflogd/privsep_fdpass.c b/sbin/pflogd/privsep_fdpass.c index 0e6c3c4c1e8..ad618616ed9 100644 --- a/sbin/pflogd/privsep_fdpass.c +++ b/sbin/pflogd/privsep_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_fdpass.c,v 1.5 2008/03/24 16:11:08 deraadt Exp $ */ +/* $OpenBSD: privsep_fdpass.c,v 1.6 2012/04/04 17:24:50 deraadt Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> @@ -107,8 +107,10 @@ receive_fd(int sock) msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); - if ((n = recvmsg(sock, &msg, 0)) == -1) + if ((n = recvmsg(sock, &msg, 0)) == -1) { warn("%s: recvmsg", __func__); + return -1; + } if (n != sizeof(int)) warnx("%s: recvmsg: expected received 1 got %ld", __func__, (long)n); diff --git a/usr.sbin/syslogd/privsep_fdpass.c b/usr.sbin/syslogd/privsep_fdpass.c index a9a2e6a1b7e..6984929fa9e 100644 --- a/usr.sbin/syslogd/privsep_fdpass.c +++ b/usr.sbin/syslogd/privsep_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_fdpass.c,v 1.7 2008/03/24 16:11:05 deraadt Exp $ */ +/* $OpenBSD: privsep_fdpass.c,v 1.8 2012/04/04 17:24:50 deraadt Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> @@ -107,8 +107,10 @@ receive_fd(int sock) msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); - if ((n = recvmsg(sock, &msg, 0)) == -1) + if ((n = recvmsg(sock, &msg, 0)) == -1) { warn("%s: recvmsg", "receive_fd"); + return -1; + } if (n != sizeof(int)) warnx("%s: recvmsg: expected received 1 got %ld", "receive_fd", (long)n); diff --git a/usr.sbin/tcpdump/privsep_fdpass.c b/usr.sbin/tcpdump/privsep_fdpass.c index 203ba07c324..2c0b3f2d372 100644 --- a/usr.sbin/tcpdump/privsep_fdpass.c +++ b/usr.sbin/tcpdump/privsep_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_fdpass.c,v 1.7 2008/03/24 16:11:06 deraadt Exp $ */ +/* $OpenBSD: privsep_fdpass.c,v 1.8 2012/04/04 17:24:50 deraadt Exp $ */ /* * Copyright (c) 2002 Matthieu Herrb @@ -89,8 +89,10 @@ receive_fd(int sock) msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); - if ((n = recvmsg(sock, &msg, 0)) == -1) + if ((n = recvmsg(sock, &msg, 0)) == -1) { warn("%s: recvmsg", __func__); + return -1; + } if (n != sizeof(int)) warnx("%s: recvmsg: expected received 1 got %ld", __func__, (long)n); |