Refactor setting of directories
[src/app-framework-binder.git] / src / main.c
index 6db1e2a..0bfa529 100644 (file)
@@ -444,11 +444,16 @@ static void start()
                goto error;
        }
 
+       /* set the directories */
        mkdir(config->workdir, S_IRWXU | S_IRGRP | S_IXGRP);
        if (chdir(config->workdir) < 0) {
                ERROR("Can't enter working dir %s", config->workdir);
                goto error;
        }
+       if (afb_common_rootdir_set(config->rootdir) < 0) {
+               ERROR("failed to set common root directory");
+               goto error;
+       }
 
        /* install hooks */
        if (config->tracereq)
@@ -472,12 +477,6 @@ static void start()
                goto error;
        }
 
-       // set the root dir
-       if (afb_common_rootdir_set(config->rootdir) < 0) {
-               ERROR("failed to set common root directory");
-               goto error;
-       }
-
        DEBUG("Init config done");
 
        /* start the services */