log: remove unused callbacks
[project/ubox.git] / log / logd.c
index 5c614f6..4a7a746 100644 (file)
@@ -55,15 +55,9 @@ client_close(struct ustream *s)
        free(cl);
 }
 
-static void
-client_notify_write(struct ustream *s, int bytes)
-{
-       client_close(s);
-}
-
 static void client_notify_state(struct ustream *s)
 {
-       return client_close(s);
+       client_close(s);
 }
 
 static int
@@ -83,10 +77,12 @@ read_log(struct ubus_context *ctx, struct ubus_object *obj,
                        count = blobmsg_get_u32(tb);
        }
 
-       pipe(fds);
+       if (pipe(fds) == -1) {
+               fprintf(stderr, "logd: failed to create pipe: %s\n", strerror(errno));
+               return -1;
+       }
        ubus_request_set_fd(ctx, req, fds[0]);
        cl = calloc(1, sizeof(*cl));
-       cl->s.stream.notify_write = client_notify_write;
        cl->s.stream.notify_state = client_notify_state;
        cl->fd = fds[1];
        ustream_fd_init(&cl->s, cl->fd);
@@ -165,8 +161,10 @@ ubus_connect_handler(struct ubus_context *ctx)
        int ret;
 
        ret = ubus_add_object(ctx, &log_object);
-       if (ret)
+       if (ret) {
                fprintf(stderr, "Failed to add object: %s\n", ubus_strerror(ret));
+               exit(1);
+       }
        fprintf(stderr, "log: connected to ubus\n");
 }