projects
/
umurmur.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #116 from C4K3/deprecate-autotools
[umurmur.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index a18363dd721bc579bdbcd842e295d4c8b0223132..c74d9646bd71f168ee29627019a76da272ca61ba 100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-322,16
+322,25
@@
int main(int argc, char **argv)
Log_init(false);
if (pidfile != NULL)
lockfile(pidfile);
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);
}
else Log_init(true);
+#ifdef POSIX_PRIORITY_SCHEDULING
+ /* We still want to set scheduling policy if nodaemon is specified,
+ * but if we are daemonizing setscheduler() will be called above */
+ if (nodaemon) {
+ if (realtime)
+ setscheduler();
+ }
+#endif
+
signal(SIGCHLD, SIG_IGN); /* ignore child */
signal(SIGTSTP, SIG_IGN); /* ignore tty signals */
signal(SIGTTOU, SIG_IGN);
signal(SIGCHLD, SIG_IGN); /* ignore child */
signal(SIGTSTP, SIG_IGN); /* ignore tty signals */
signal(SIGTTOU, SIG_IGN);
@@
-360,10
+369,15
@@
int main(int argc, char **argv)
Sharedmemory_init( bindport, bindport6 );
#endif
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();
+
+ /* Reopen log file. If user switch results in access denied, we catch
+ * it early.
+ */
+ Log_reset();
+ }
Server_run();
Server_run();