X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=main.c;h=bbec86005ece242888527c139d004e783d1b6f83;hp=bed0edd4167c2e25a2e5465cb798bb3c741d81d4;hb=0942c9368654ee1a0518bbeaf291a51852c11543;hpb=26486b46eada232ef807f3d969ffdec33d5e4858 diff --git a/main.c b/main.c index bed0edd..bbec860 100644 --- a/main.c +++ b/main.c @@ -90,7 +90,7 @@ retry: maxlen = LOG_BUF_SIZE - proc->log_buf_ofs; read_len = len = read(fd->fd, buf, maxlen); if (len < 0) { - if (errno == EAGAIN) + if (errno == EINTR) goto retry; goto out; @@ -99,9 +99,13 @@ retry: proc->log_buf_ofs += len; - cur = buf; + len = proc->log_buf_ofs; buf = proc->log_buf; - while (len > 0 && (cur = memchr(cur, '\n', len))) { + while (len > 0) { + cur = memchr(buf, '\n', len); + if (!cur) + break; + *cur = 0; if (!proc->log_overflow) @@ -116,7 +120,7 @@ retry: } if (buf > proc->log_buf && len > 0) - memmove(buf, proc->log_buf, len); + memmove(proc->log_buf, buf, len); if (len == LOG_BUF_SIZE) { if (!proc->log_overflow) { @@ -219,7 +223,7 @@ netifd_kill_process(struct netifd_process *proc) if (!proc->uloop.pending) return; - kill(proc->uloop.pid, SIGTERM); + kill(proc->uloop.pid, SIGKILL); netifd_delete_process(proc); }