diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-19 20:56:09 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-03-19 20:56:09 +0100 |
commit | f4c907480f85faa88dbf19270bb8f02d7b15d6f1 (patch) | |
tree | 137a8937eb337bf4b5ad6123a41f8ba7f4bb6d20 | |
parent | 17f3e46961723c1ae512dee4492d809c505260dc (diff) |
simplify log buffer handling
-rw-r--r-- | main.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -73,7 +73,7 @@ netifd_process_log_cb(struct uloop_fd *fd, unsigned int events) { struct netifd_process *proc; const char *log_prefix; - char *buf, *start, *cur; + char *buf, *cur; int maxlen, len, read_len; proc = container_of(fd, struct netifd_process, log_uloop); @@ -99,10 +99,10 @@ retry: proc->log_buf_ofs += len; - cur = buf; - start = proc->log_buf; + len = proc->log_buf_ofs; + buf = proc->log_buf; while (len > 0) { - cur = memchr(cur, '\n', len); + cur = memchr(buf, '\n', len); if (!cur) break; @@ -110,13 +110,13 @@ retry: if (!proc->log_overflow) netifd_log_message(L_NOTICE, "%s (%d): %s\n", - log_prefix, proc->uloop.pid, start); + log_prefix, proc->uloop.pid, buf); else proc->log_overflow = false; cur++; len -= cur - buf; - buf = start = cur; + buf = cur; } if (buf > proc->log_buf && len > 0) |