logd: enforce line length limit for ubus based log messages as well
[project/ubox.git] / log / logread.c
index edac1d9..0cae75b 100644 (file)
@@ -236,8 +236,11 @@ static void logread_fd_data_cb(struct ustream *s, int bytes)
                log_notify(a);
                ustream_consume(s, cur_len);
        }
-       if (!log_follow)
-               uloop_end();
+}
+
+static void logread_fd_state_cb(struct ustream *s)
+{
+       uloop_end();
 }
 
 static void logread_fd_cb(struct ubus_request *req, int fd)
@@ -245,6 +248,7 @@ static void logread_fd_cb(struct ubus_request *req, int fd)
        static struct ustream_fd test_fd;
 
        test_fd.stream.notify_read = logread_fd_data_cb;
+       test_fd.stream.notify_state = logread_fd_state_cb;
        ustream_fd_init(&test_fd, fd);
 }
 
@@ -331,6 +335,7 @@ int main(int argc, char **argv)
 
                blob_buf_init(&b, 0);
                blobmsg_add_u8(&b, "stream", 1);
+               blobmsg_add_u8(&b, "oneshot", !log_follow);
                if (lines)
                        blobmsg_add_u32(&b, "lines", lines);
                else if (log_follow)