proto-shell: defer init until after command line option processing
authorFelix Fietkau <nbd@openwrt.org>
Fri, 7 Mar 2014 18:12:16 +0000 (19:12 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 7 Mar 2014 18:12:16 +0000 (19:12 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
main.c
proto-shell.c
proto.h

diff --git a/main.c b/main.c
index fb6deed..f70db54 100644 (file)
--- a/main.c
+++ b/main.c
@@ -25,6 +25,7 @@
 #include "system.h"
 #include "interface.h"
 #include "wireless.h"
 #include "system.h"
 #include "interface.h"
 #include "wireless.h"
+#include "proto.h"
 
 unsigned int debug_mask = 0;
 const char *main_path = DEFAULT_MAIN_PATH;
 
 unsigned int debug_mask = 0;
 const char *main_path = DEFAULT_MAIN_PATH;
@@ -326,6 +327,7 @@ int main(int argc, char **argv)
                return 1;
        }
 
                return 1;
        }
 
+       proto_shell_init();
        wireless_init();
 
        if (system_init()) {
        wireless_init();
 
        if (system_init()) {
index 37859f4..9041045 100644 (file)
@@ -769,7 +769,7 @@ proto_shell_add_handler(const char *script, const char *name, json_object *obj)
        add_proto_handler(proto);
 }
 
        add_proto_handler(proto);
 }
 
-static void __init proto_shell_init(void)
+void proto_shell_init(void)
 {
        proto_fd = netifd_open_subdir("proto");
        if (proto_fd < 0)
 {
        proto_fd = netifd_open_subdir("proto");
        if (proto_fd < 0)
diff --git a/proto.h b/proto.h
index 996196b..e402a91 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -73,5 +73,6 @@ unsigned int parse_netmask_string(const char *str, bool v6);
 int proto_apply_static_ip_settings(struct interface *iface, struct blob_attr *attr);
 int proto_apply_ip_settings(struct interface *iface, struct blob_attr *attr, bool ext);
 void proto_dump_handlers(struct blob_buf *b);
 int proto_apply_static_ip_settings(struct interface *iface, struct blob_attr *attr);
 int proto_apply_ip_settings(struct interface *iface, struct blob_attr *attr, bool ext);
 void proto_dump_handlers(struct blob_buf *b);
+void proto_shell_init(void);
 
 #endif
 
 #endif