From 0d005d65e7d8546b2a5025250ee9123ecfac655d Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 24 Feb 2023 10:16:26 +0000 Subject: [PATCH] control: Improve error handling if reading a control message fails --- src/control.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/control.c b/src/control.c index 756fe05e..0b7133e2 100644 --- a/src/control.c +++ b/src/control.c @@ -100,15 +100,15 @@ control_handle_read(struct fd_list *fd) ssize_t bytes; bytes = read(fd->fd, buffer, sizeof(buffer) - 1); -#ifdef PRIVSEP - if (bytes == 0 && IN_PRIVSEP(fd->ctx)) { - if (ps_ctl_sendeof(fd) == -1) - logerr(__func__); - } -#endif if (bytes == -1) logerr(__func__); if (bytes == -1 || bytes == 0) { +#ifdef PRIVSEP + if (IN_PRIVSEP(fd->ctx)) { + if (ps_ctl_sendeof(fd) == -1) + logerr(__func__); + } +#endif control_free(fd); return; } -- 2.47.2