X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=main.c;h=f180c30b1826dbfbd136e6df2476a6e4b8aaddf8;hp=02fd9ffa1b7b08135408b8fdf89c2c2fa9422085;hb=fb0e4138070d7c2ce723af5780e763af3a1353d8;hpb=2f976c53919e49b9008e9d5f23349be3c992e87b diff --git a/main.c b/main.c index 02fd9ff..f180c30 100644 --- a/main.c +++ b/main.c @@ -23,14 +23,6 @@ static struct list_head fds = LIST_HEAD_INIT(fds); #define DEFAULT_LOG_LEVEL L_NOTICE -enum { - L_CRIT, - L_WARNING, - L_NOTICE, - L_INFO, - L_DEBUG -}; - static int log_level = DEFAULT_LOG_LEVEL; static const int log_class[] = { [L_CRIT] = LOG_CRIT, @@ -94,12 +86,14 @@ netifd_process_log_cb(struct uloop_fd *fd, unsigned int events) retry: read_len = len = read(fd->fd, buf, maxlen); - if (len <= 0) { - if (errno == EINTR) + if (len < 0) { + if (errno == EAGAIN) goto retry; - return; - } + goto out; + } else if (len == 0) + goto out; + proc->log_buf_ofs += len; cur = buf; @@ -134,6 +128,10 @@ retry: if (read_len == maxlen) goto retry; + +out: + if (fd->eof) + uloop_fd_delete(fd); } static void @@ -240,7 +238,7 @@ static void netifd_do_restart(struct uloop_timeout *timeout) static void netifd_do_reload(struct uloop_timeout *timeout) { - config_init_interfaces(NULL); + config_init_all(); } static struct uloop_timeout main_timer; @@ -360,7 +358,7 @@ int main(int argc, char **argv) return 1; } - config_init_interfaces(NULL); + config_init_all(); uloop_run(); netifd_kill_processes();