From b4a75b3e9620dc1f318250c17a754251379a0822 Mon Sep 17 00:00:00 2001 From: matthieu Date: Wed, 4 Apr 2012 20:34:55 +0000 Subject: [PATCH] Return an error much earlier if recvmsg fails. --- xserver/os/privsep.c | 6 ++++-- 1 file 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 * 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) {