X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fserver_main.c;h=134e564348432a257d4b90bc0427b5be8aed51e5;hb=8eac29db12e027867644fcac287a6b4c34e067c7;hp=d777897000dfe2e88977ebe1efb8cc074bdd4b79;hpb=7171da73d800ab3e60810a8e6c69099ed706c716;p=citadel.git diff --git a/citadel/server_main.c b/citadel/server_main.c index d77789700..134e56434 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifdef HAVE_PTHREAD_H #include #endif @@ -79,6 +80,9 @@ int main(int argc, char **argv) int home=0; char relhome[PATH_MAX]=""; char ctdldir[PATH_MAX]=CTDLDIR; +#ifdef HAVE_RUN_DIR + struct stat filestats; +#endif /* initialize the master context */ InitializeMasterCC(); @@ -183,6 +187,19 @@ int main(int argc, char **argv) config.c_ipgm_secret = rand(); put_config(); +#ifdef HAVE_RUN_DIR + /* on some dists rundir gets purged on startup. so we need to recreate it. */ + + if (stat(ctdl_run_dir, &filestats)==-1){ + pw=getpwuid(config.c_ctdluid); + mkdir(ctdl_run_dir, 0755); + chown(ctdl_run_dir, config.c_ctdluid, (pw==NULL)?-1:pw->pw_gid); + + } + + +#endif + /* Initialize... */ init_sysdep();