From f35f98735712930b960bc9d1b0880284ec4a5c20 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Wed, 4 Apr 2012 20:34:56 +0000 Subject: Return an error much earlier if recvmsg fails. --- xserver/os/privsep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xserver') 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 * 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) { -- cgit v1.2.3