summaryrefslogtreecommitdiff
path: root/xserver
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2011-01-28 19:37:56 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2011-01-28 19:37:56 +0000
commit1050dc95865a74680d083798aa8a1d4be4f9e5da (patch)
tree081d9c683f341766c10d208537d57b5c42c1dec9 /xserver
parentf8a38f23d2503317bf965e741c083d46fbfaedf3 (diff)
restart recvmsg() if returning with errno==EINTR.
Fixes a crash on server reset on some machines. Code inspired by ssh, with feedback from guenther@ and millert@ ok guenther@ miod@
Diffstat (limited to 'xserver')
-rw-r--r--xserver/os/privsep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xserver/os/privsep.c b/xserver/os/privsep.c
index 1f16a6918..cdeeac9ff 100644
--- a/xserver/os/privsep.c
+++ b/xserver/os/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.16 2010/12/22 21:36:05 matthieu Exp $ */
+/* $OpenBSD: privsep.c,v 1.17 2011/01/28 19:37:55 matthieu Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -198,8 +198,10 @@ receive_fd(int socket)
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
- if ((n = recvmsg(socket, &msg, 0)) == -1)
- warn("%s: recvmsg", __func__);
+ do
+ n = recvmsg(socket, &msg, 0);
+ while (n == -1 && errno == EINTR);
+
if (n != sizeof(int))
warnx("%s: recvmsg: expected received 1 got %ld",
__func__, (long)n);