From fd88ed42c8615e4fab1cbe01343858e27e82c279 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 29 Oct 2013 15:26:32 -0600 Subject: [PATCH] Use MSG_WAITALL when receiving struct command_status over the Unix domain socket since we no longer use datagrams. This should avoid the need to handle incomplete reads, though in theory it is still possible. --- src/exec.c | 2 +- src/exec_pty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/exec.c b/src/exec.c index 383a0c351..9e8021036 100644 --- a/src/exec.c +++ b/src/exec.c @@ -208,7 +208,7 @@ backchannel_cb(int fd, int what, void *v) debug_decl(backchannel_cb, SUDO_DEBUG_EXEC) /* read child status */ - n = recv(fd, ec->cstat, sizeof(struct command_status), 0); + n = recv(fd, ec->cstat, sizeof(struct command_status), MSG_WAITALL); if (n != sizeof(struct command_status)) { if (n == -1) { switch (errno) { diff --git a/src/exec_pty.c b/src/exec_pty.c index 278ec531f..aa55163bc 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -1141,7 +1141,7 @@ mon_backchannel_cb(int fd, int what, void *v) debug_decl(mon_backchannel_cb, SUDO_DEBUG_EXEC); /* read command from backchannel, should be a signal */ - n = recv(fd, &cstmp, sizeof(cstmp), 0); + n = recv(fd, &cstmp, sizeof(cstmp), MSG_WAITALL); if (n != sizeof(cstmp)) { if (n == -1) { if (errno == EINTR || errno == EAGAIN)