make procd wait for ubus to come up
[project/procd.git] / plug / hotplug.c
index b50c04e..061833a 100644 (file)
@@ -22,6 +22,7 @@
 #include <libubox/blobmsg_json.h>
 #include <libubox/json_script.h>
 #include <libubox/uloop.h>
+#include <json/json.h>
 
 #include <fcntl.h>
 #include <unistd.h>
@@ -335,7 +336,7 @@ rule_handle_file(struct json_script_ctx *ctx, const char *name)
        json_object *obj;
 
        obj = json_object_from_file((char*)name);
-       if (is_error(obj))
+       if (!obj)
                return NULL;
 
        blob_buf_init(&script, 0);
@@ -463,10 +464,8 @@ void hotplug(char *rules)
                exit(1);
        }
 
-       if (setsockopt(hotplug_fd.fd, SOL_SOCKET, SO_RCVBUFFORCE, &nlbufsize, sizeof(nlbufsize))) {
+       if (setsockopt(hotplug_fd.fd, SOL_SOCKET, SO_RCVBUFFORCE, &nlbufsize, sizeof(nlbufsize)))
                ERROR("Failed to resize receive buffer: %s\n", strerror(errno));
-               exit(1);
-       }
 
        json_script_init(&jctx);
        queue_proc.cb = queue_proc_cb;