summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-12-01 21:42:13 +1100
committerDarren Tucker <dtucker@zip.com.au>2008-12-01 21:42:13 +1100
commit23645649bb97d510a7eab33d36882ef34d2e2d1f (patch)
tree24975a40bff63f6e48bb7209058497185f79e6f8 /monitor_fdpass.c
parent99d11a3ed2eb13e2f3ba13280d416369c45a30a6 (diff)
- dtucker@cvs.openbsd.org 2008/11/30 11:59:26
[monitor_fdpass.c] Retry sendmsg/recvmsg on EAGAIN and EINTR; ok djm@
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r--monitor_fdpass.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index f68c3728..4b9a066b 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_fdpass.c,v 1.17 2008/03/24 16:11:07 deraadt Exp $ */
+/* $OpenBSD: monitor_fdpass.c,v 1.18 2008/11/30 11:59:26 dtucker Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -75,7 +75,10 @@ mm_send_fd(int sock, int fd)
msg.msg_iov = &vec;
msg.msg_iovlen = 1;
- if ((n = sendmsg(sock, &msg, 0)) == -1) {
+ while ((n = sendmsg(sock, &msg, 0)) == -1 && (errno == EAGAIN ||
+ errno == EINTR))
+ debug3("%s: sendmsg(%d): %s", __func__, fd, strerror(errno));
+ if (n == -1) {
error("%s: sendmsg(%d): %s", __func__, fd,
strerror(errno));
return -1;
@@ -123,7 +126,10 @@ mm_receive_fd(int sock)
msg.msg_controllen = sizeof(cmsgbuf.buf);
#endif
- if ((n = recvmsg(sock, &msg, 0)) == -1) {
+ while ((n = recvmsg(sock, &msg, 0)) == -1 && (errno == EAGAIN ||
+ errno == EINTR))
+ debug3("%s: recvmsg: %s", __func__, strerror(errno));
+ if (n == -1) {
error("%s: recvmsg: %s", __func__, strerror(errno));
return -1;
}