]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
control: Improve error handling if reading a control message fails
authorRoy Marples <roy@alpine.my.domain>
Fri, 24 Feb 2023 10:16:26 +0000 (10:16 +0000)
committerRoy Marples <roy@alpine.my.domain>
Fri, 24 Feb 2023 10:16:26 +0000 (10:16 +0000)
src/control.c

index 756fe05eddb42b01d0bcc75b9d854bd8cb888c32..0b7133e2314be2f95ffeebc174374343a3cda21c 100644 (file)
@@ -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;
        }