diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2008-11-30 11:59:27 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2008-11-30 11:59:27 +0000 |
commit | 26138f951bac698e75ddcfab4835cf7a79bb75dd (patch) | |
tree | 63a37eb098a2fb499619ca9932f0834633b767b3 /usr.bin/ssh | |
parent | c2610f19c3aedb9c41b38983e51fbce1a8a73845 (diff) |
Retry sendmsg/recvmsg on EAGAIN and EINTR; ok djm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/monitor_fdpass.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/ssh/monitor_fdpass.c b/usr.bin/ssh/monitor_fdpass.c index ea6def12f4e..d6da36b5385 100644 --- a/usr.bin/ssh/monitor_fdpass.c +++ b/usr.bin/ssh/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. @@ -62,7 +62,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; @@ -98,7 +101,10 @@ mm_receive_fd(int sock) msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); - 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; } |