state.c: pass ubus commandline is writable buffer to service_start_early()
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Jan 2014 18:06:28 +0000 (18:06 +0000)
committerJohn Crispin <blogic@openwrt.org>
Mon, 20 Jan 2014 18:06:28 +0000 (18:06 +0000)
The service_start_early() function uses strtok() on the command line argument,
therfore we cannot pass it constant string literals directly.

Fixes OpenWrt bug #14832

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
state.c

diff --git a/state.c b/state.c
index 9f3033be83299e3a5f760b7e510aad2a9eae8fde..e5f0015befd380a8e469873030a3cf03f44abe63 100644 (file)
--- a/state.c
+++ b/state.c
@@ -37,6 +37,7 @@ static int reboot_event;
 
 static void state_enter(void)
 {
+       char ubus_cmd[] = "/sbin/ubusd";
 
        switch (state) {
        case STATE_EARLY:
@@ -54,7 +55,7 @@ static void state_enter(void)
 
                LOG("- init -\n");
                service_init();
-               service_start_early("ubus", "/sbin/ubusd");
+               service_start_early("ubus", ubus_cmd);
 
                procd_inittab();
                procd_inittab_run("respawn");