mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Replaced signal() calls by sigaction() calls to avoid Solaris problems, thanks to Paul T. Keener
SVN revision: 2207
This commit is contained in:
parent
7406bc589d
commit
8859bfd238
28
src/elogd.c
28
src/elogd.c
@ -27670,6 +27670,13 @@ void server_loop(void)
|
|||||||
SSL_CTX *ssl_ctx;
|
SSL_CTX *ssl_ctx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OS_UNIX
|
||||||
|
/* sigaction structs */
|
||||||
|
struct sigaction ctrlc_handle;
|
||||||
|
struct sigaction ignore_handle;
|
||||||
|
struct sigaction hup_handle;
|
||||||
|
#endif
|
||||||
|
|
||||||
i_conn = content_length = 0;
|
i_conn = content_length = 0;
|
||||||
net_buffer_size = 100000;
|
net_buffer_size = 100000;
|
||||||
net_buffer = xmalloc(net_buffer_size);
|
net_buffer = xmalloc(net_buffer_size);
|
||||||
@ -27825,11 +27832,22 @@ void server_loop(void)
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* install signal handler */
|
/* install signal handlers */
|
||||||
signal(SIGTERM, ctrlc_handler);
|
ctrlc_handle.sa_handler = ctrlc_handler;
|
||||||
signal(SIGINT, ctrlc_handler);
|
sigemptyset(&ctrlc_handle.sa_mask);
|
||||||
signal(SIGPIPE, SIG_IGN);
|
ctrlc_handle.sa_flags = 0;
|
||||||
signal(SIGHUP, hup_handler);
|
|
||||||
|
sigaction(SIGTERM, &ctrlc_handle, NULL);
|
||||||
|
sigaction(SIGINT, &ctrlc_handle, NULL);
|
||||||
|
|
||||||
|
ignore_handle.sa_handler = SIG_IGN;
|
||||||
|
sigaction(SIGPIPE, &ignore_handle, NULL);
|
||||||
|
|
||||||
|
hup_handle.sa_handler = hup_handler;
|
||||||
|
sigemptyset(&hup_handle.sa_mask);
|
||||||
|
hup_handle.sa_flags = 0;
|
||||||
|
sigaction(SIGHUP, &hup_handle, NULL);
|
||||||
|
|
||||||
/* give up root privilege */
|
/* give up root privilege */
|
||||||
if (geteuid() == 0) {
|
if (geteuid() == 0) {
|
||||||
if (!getcfg("global", "Grp", str, sizeof(str)) || setegroup(str) < 0) {
|
if (!getcfg("global", "Grp", str, sizeof(str)) || setegroup(str) < 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user