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.
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user