system-linux: fix deletion of ip tunnels (FS#4058)
[project/netifd.git] / main.c
diff --git a/main.c b/main.c
index c173cef35be5a840d1d9d5d3b67c3eeab3f0c3b0..0fb72b344f2317f6cb9745f433952ce2c69b7f3f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -26,6 +26,7 @@
 #include "interface.h"
 #include "wireless.h"
 #include "proto.h"
+#include "extdev.h"
 
 unsigned int debug_mask = 0;
 const char *main_path = DEFAULT_MAIN_PATH;
@@ -56,6 +57,7 @@ static bool use_syslog = true;
 static void
 netifd_delete_process(struct netifd_process *proc)
 {
+       while (ustream_poll(&proc->log.stream));
        list_del(&proc->list);
        ustream_free(&proc->log.stream);
        close(proc->log.fd.fd);
@@ -126,7 +128,6 @@ netifd_process_cb(struct uloop_process *proc, int ret)
        struct netifd_process *np;
        np = container_of(proc, struct netifd_process, uloop);
 
-       while (ustream_poll(&np->log.stream));
        netifd_delete_process(np);
        return np->cb(np, ret);
 }
@@ -325,6 +326,7 @@ int main(int argc, char **argv)
        }
 
        proto_shell_init();
+       extdev_init();
        wireless_init();
 
        if (system_init()) {