fix(feuille.c): reorganize some of its code
This commit is contained in:
parent
4894825dac
commit
1694929221
1 changed files with 7 additions and 6 deletions
13
feuille.c
13
feuille.c
|
@ -171,9 +171,13 @@ int main(int argc, char *argv[])
|
||||||
/* locale */
|
/* locale */
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
/* syslog setup */
|
/* syslog */
|
||||||
openlog("feuille", LOG_NDELAY | LOG_PERROR, LOG_USER);
|
openlog("feuille", LOG_NDELAY | LOG_PERROR, LOG_USER);
|
||||||
|
|
||||||
|
/* ignore signals that could kill feuille */
|
||||||
|
signal(SIGPIPE, SIG_IGN); /* when send(2) or write(2) fails */
|
||||||
|
|
||||||
|
|
||||||
/* settings */
|
/* settings */
|
||||||
long long tmp;
|
long long tmp;
|
||||||
|
|
||||||
|
@ -347,6 +351,7 @@ int main(int argc, char *argv[])
|
||||||
if ((server = initialize_server()) == -1)
|
if ((server = initialize_server()) == -1)
|
||||||
die(errno, "Failed to initialize server socket: %s\n", strerror(errno));
|
die(errno, "Failed to initialize server socket: %s\n", strerror(errno));
|
||||||
|
|
||||||
|
|
||||||
/* make feuille run in the background */
|
/* make feuille run in the background */
|
||||||
if (!settings.foreground) {
|
if (!settings.foreground) {
|
||||||
verbose(1, "making feuille run in the background...");
|
verbose(1, "making feuille run in the background...");
|
||||||
|
@ -355,11 +360,6 @@ int main(int argc, char *argv[])
|
||||||
daemon(1, 0);
|
daemon(1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore most signals that could kill feuille */
|
|
||||||
verbose(3, "ignoring signals that could kill feuille...");
|
|
||||||
|
|
||||||
signal(SIGPIPE, SIG_IGN); /* when send(2) or write(2) fails */
|
|
||||||
|
|
||||||
|
|
||||||
/* chroot and drop root permissions */
|
/* chroot and drop root permissions */
|
||||||
if (getuid() == 0) {
|
if (getuid() == 0) {
|
||||||
|
@ -382,6 +382,7 @@ int main(int argc, char *argv[])
|
||||||
pledge("proc stdio rpath wpath cpath inet", "stdio rpath wpath cpath inet");
|
pledge("proc stdio rpath wpath cpath inet", "stdio rpath wpath cpath inet");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
/* create a thread pool for incoming connections */
|
/* create a thread pool for incoming connections */
|
||||||
verbose(1, "initializing worker pool...");
|
verbose(1, "initializing worker pool...");
|
||||||
|
|
Reference in a new issue