logd: fix default initialization of line count
authorFelix Fietkau <nbd@nbd.name>
Thu, 22 Sep 2016 18:20:29 +0000 (20:20 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 22 Sep 2016 18:28:22 +0000 (20:28 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
log/logd.c

index 3f8045912f1a6d88b844005ceaa58a81ba4d2656..58a1dec4a3d4b4ce1b2f169d058448ffda91df8e 100644 (file)
@@ -92,6 +92,9 @@ read_log(struct ubus_context *ctx, struct ubus_object *obj,
        int ret;
        bool stream = true;
 
+       if (!stream)
+               count = 100;
+
        if (msg) {
                blobmsg_parse(read_policy, __READ_MAX, tb, blob_data(msg), blob_len(msg));
                if (tb[READ_LINES])
@@ -99,8 +102,6 @@ read_log(struct ubus_context *ctx, struct ubus_object *obj,
                if (tb[READ_STREAM])
                        stream = blobmsg_get_bool(tb[READ_STREAM]);
        }
-       if (!stream)
-               count = 100;
 
        if (pipe(fds) == -1) {
                fprintf(stderr, "logd: failed to create pipe: %s\n", strerror(errno));