- dtucker@cvs.openbsd.org 2008/11/30 11:59:26
[monitor_fdpass.c]
Retry sendmsg/recvmsg on EAGAIN and EINTR; ok djm@
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index f68c372..4b9a066 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 @@
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 @@
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;
}