diff options
author | John Crispin <blogic@openwrt.org> | 2015-03-28 18:12:21 +0100 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2015-03-30 14:14:22 +0200 |
commit | 73a7133b6e42edc218da5b8011c580ed48c7731a (patch) | |
tree | 71bf65b4c602e14fd8c17ff2ff94db9d394c2b19 /src/config.c | |
parent | 3b4e6d19b7ce0953efcd6d1c545b031b73e0ab6e (diff) |
properly handle return codes
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c index 5fbb921..9dbe7f0 100644 --- a/src/config.c +++ b/src/config.c @@ -683,9 +683,10 @@ void odhcpd_reload(void) static void handle_signal(int signal) { char b[1] = {0}; - if (signal == SIGHUP) - write(reload_pipe[1], b, sizeof(b)); - else + + if (signal == SIGHUP) { + if (write(reload_pipe[1], b, sizeof(b)) < 0) {} + } else uloop_end(); } @@ -694,7 +695,7 @@ static void handle_signal(int signal) static void reload_cb(struct uloop_fd *u, _unused unsigned int events) { char b[512]; - read(u->fd, b, sizeof(b)); + if (read(u->fd, b, sizeof(b) < 0)) {} odhcpd_reload(); } @@ -702,7 +703,7 @@ static struct uloop_fd reload_fd = { .cb = reload_cb }; void odhcpd_run(void) { - pipe2(reload_pipe, O_NONBLOCK | O_CLOEXEC); + if (pipe2(reload_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {} reload_fd.fd = reload_pipe[0]; uloop_fd_add(&reload_fd, ULOOP_READ); |