]> code.citadel.org Git - citadel.git/blobdiff - citadel/server_main.c
New versions of Berkeley DB (I tested with 4.5.20) seem to
[citadel.git] / citadel / server_main.c
index c46f80a37b0919bd21923156471b847533db5811..7f9551ebc8bec39dfbbc10a4b409291fcb24c1b7 100644 (file)
@@ -160,12 +160,7 @@ int main(int argc, char **argv)
         * facilities when we need to...
         */
        if (enable_syslog) {
-               if (running_as_daemon) {
-                       openlog("citadel", LOG_NDELAY, 0);
-               }
-               else {
-                       openlog("citadel", LOG_PERROR|LOG_NDELAY, 0);
-               }
+               openlog("citadel", LOG_NDELAY, 0);
                setlogmask(LOG_UPTO(verbosity));
        }
        
@@ -196,7 +191,11 @@ int main(int argc, char **argv)
        /* on some dists rundir gets purged on startup. so we need to recreate it. */
 
        if (stat(ctdl_run_dir, &filestats)==-1){
+#ifdef SOLARIS_GETPWUID
+               pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
+#else
                getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
+#endif
                mkdir(ctdl_run_dir, 0755);
                chown(ctdl_run_dir, config.c_ctdluid, (pwp==NULL)?-1:pw.pw_gid);
        }
@@ -242,8 +241,13 @@ int main(int argc, char **argv)
         * corresponding group ids
         */
        if (drop_root_perms) {
-               getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
+               cdb_chmod_data();       /* make sure we own our data files */
 
+#ifdef SOLARIS_GETPWUID
+               pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
+#else
+               getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
+#endif
                if (pwp == NULL)
                        lprintf(CTDL_CRIT, "WARNING: getpwuid(%ld): %s\n"
                                   "Group IDs will be incorrect.\n", (long)CTDLUID,