Log_init(false);
if (pidfile != NULL)
lockfile(pidfile);
-
+#ifdef POSIX_PRIORITY_SCHEDULING
+ /* Set the scheduling policy, has to be called after daemonizing
+ * but before we drop privileges */
+ if (realtime)
+ setscheduler();
+#endif
+
- switch_user();
-
- /* Reopen log file. If user switch results in access denied, we catch
- * it early.
- */
- Log_reset();
}
else Log_init(true);
Sharedmemory_init( bindport, bindport6 );
#endif
-#ifdef POSIX_PRIORITY_SCHEDULING
- if (realtime)
- setscheduler();
-#endif
++ if(!nodaemon) {
++ /* SSL and scheduling is setup, we can drop privileges now */
++ switch_user();
+
- switch_user();
- /* Reopen log file. If user switch results in access denied, we catch
- * it early.
- */
- Log_reset();
++ /* Reopen log file. If user switch results in access denied, we catch
++ * it early.
++ */
++ Log_reset();
++ }
+
Server_run();
#ifdef USE_SHAREDMEMORY_API