summaryrefslogtreecommitdiff
path: root/xserver
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2012-04-04 20:34:56 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2012-04-04 20:34:56 +0000
commitf35f98735712930b960bc9d1b0880284ec4a5c20 (patch)
treea18b88c8a07dad3853a350987c57f5e539e0f40f /xserver
parent2b176649364072321453f1cd0563a8424a17b3d2 (diff)
Return an error much earlier if recvmsg fails.
Diffstat (limited to 'xserver')
-rw-r--r--xserver/os/privsep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xserver/os/privsep.c b/xserver/os/privsep.c
index 87ea54330..ac8087fb3 100644
--- a/xserver/os/privsep.c
+++ b/xserver/os/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.18 2011/08/20 17:30:37 matthieu Exp $ */
+/* $OpenBSD: privsep.c,v 1.19 2012/04/04 20:34:55 matthieu Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -202,9 +202,11 @@ receive_fd(int socket)
n = recvmsg(socket, &msg, 0);
while (n == -1 && errno == EINTR);
- if (n != sizeof(int))
+ if (n != sizeof(int)) {
warnx("%s: recvmsg: expected received 1 got %ld",
__func__, (long)n);
+ return -1;
+ }
if (result == 0) {
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {