]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: support HANGUP of stderr cb
authorRoy Marples <roy@marples.name>
Wed, 17 May 2023 16:39:27 +0000 (17:39 +0100)
committerRoy Marples <roy@marples.name>
Wed, 17 May 2023 16:39:27 +0000 (17:39 +0100)
src/dhcpcd.c

index d663c383e8bd6a1565a4f5f6e80e219d7add832a..3fdc177d6ea8c1ec178487f26866429d9cc07ccd 100644 (file)
@@ -1816,8 +1816,11 @@ dhcpcd_stderr_cb(void *arg, unsigned short events)
        char log[BUFSIZ];
        ssize_t len;
 
-       if (events != ELE_READ)
-               logerrx("%s: unexpected event 0x%04x", __func__, events);
+       if (events & ELE_HANGUP)
+               eloop_exit(ctx->eloop, EXIT_SUCCESS);
+
+       if (!(events & ELE_READ))
+               return;
 
        len = read(ctx->stderr_fd, log, sizeof(log));
        if (len == -1) {