fix log buffer overflow handling
[project/netifd.git] / main.c
diff --git a/main.c b/main.c
index bed0edd..3fe38bf 100644 (file)
--- 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;
@@ -116,7 +116,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 +219,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);
 }