From 2e83a5fab201630b7447bffffa5c509fa7ea743b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 6 Feb 2011 02:19:54 +0100 Subject: [PATCH] fix SIGINT handling --- libubus.c | 2 ++ ubus-example.c | 1 + 2 files changed, 3 insertions(+) diff --git a/libubus.c b/libubus.c index 66de478..8749d7c 100644 --- 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; + if (uloop_cancelled) + return false; if (errno == EINTR) continue; diff --git a/ubus-example.c b/ubus-example.c index d2e2288..f84f2b4 100644 --- a/ubus-example.c +++ b/ubus-example.c @@ -98,6 +98,7 @@ int main(int argc, char **argv) uloop_init(); ubus_add_uloop(ctx); uloop_run(); + uloop_done(); ubus_free(ctx); return 0;