fix SIGINT handling
authorFelix Fietkau <nbd@openwrt.org>
Sun, 6 Feb 2011 01:19:54 +0000 (02:19 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 6 Feb 2011 01:19:54 +0000 (02:19 +0100)
libubus.c
ubus-example.c

index 66de478..8749d7c 100644 (file)
--- a/libubus.c
+++ b/libubus.c
@@ -124,6 +124,8 @@ static bool recv_retry(int fd, struct iovec *iov, bool wait)
                bytes = read(fd, iov->iov_base, iov->iov_len);
                if (bytes < 0) {
                        bytes = 0;
                bytes = read(fd, iov->iov_base, iov->iov_len);
                if (bytes < 0) {
                        bytes = 0;
+                       if (uloop_cancelled)
+                               return false;
                        if (errno == EINTR)
                                continue;
 
                        if (errno == EINTR)
                                continue;
 
index d2e2288..f84f2b4 100644 (file)
@@ -98,6 +98,7 @@ int main(int argc, char **argv)
        uloop_init();
        ubus_add_uloop(ctx);
        uloop_run();
        uloop_init();
        ubus_add_uloop(ctx);
        uloop_run();
+       uloop_done();
 
        ubus_free(ctx);
        return 0;
 
        ubus_free(ctx);
        return 0;