Fixes handle_indirs issue
[akaros.git] / kern / src / init.c
index dfe5375..774181d 100644 (file)
@@ -81,11 +81,11 @@ void kernel_init(multiboot_info_t *mboot_info)
        vmr_init();
        file_init();
        page_check();
-       vfs_init();
-       devfs_init();
        idt_init();
        kernel_msg_init();
        timer_init();
+       vfs_init();
+       devfs_init();
        train_timing();
        kb_buf_init(&cons_buf);
        arch_init();
@@ -126,6 +126,7 @@ static int run_init_script(void)
                char *sptr = &CONFIG_INIT_SCRIPT_PATH_AND_ARGS[0];
 
                /* Figure out how many arguments there are, by finding the spaces */
+               /* TODO: consider rewriting this stuff with parsecmd */
                while (*sptr != '\0') {
                        if (*(sptr++) != ' ') {
                                vargs++;
@@ -148,11 +149,12 @@ static int run_init_script(void)
                sptr = &CONFIG_INIT_SCRIPT_PATH_AND_ARGS[0];
                while (*sptr != '\0') {
                        if (*sptr != ' ') {
-                               char *sbeg = sptr;
+                               l_argv[i++] = sptr;
                                while ((*sptr != ' ') && (*sptr != '\0'))
                                        sptr++;
+                               if (*sptr == '\0')
+                                       break;
                                *sptr = '\0';
-                               l_argv[i++] = sbeg;
                        }
                        sptr++;
                }