int epoll_fd;
int ret;
char buf[256];
- int offset;
+ int offset = 0;
epoll_fd = epoll_create(1);
if (epoll_fd < 0) {
return -1;
}
- if (!start_time)
- start_time = time(NULL);
-
ret = read_log_line(infd, buf, sizeof(buf), &offset);
if (ret < 0)
return ret;
if (ret == 0)
continue;
+ if (strlen(buf) < 5) {
+ pr_debug("discarding truncated log entry\n");
+ offset = 0;
+ continue;
+ }
+
+ if (!start_time)
+ start_time = time(NULL);
+
cur_time = time(NULL);
pr_info("%s\n", buf);