diff options
author | Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org> | 2014-11-21 21:38:56 +0100 |
---|---|---|
committer | Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org> | 2014-11-21 21:38:56 +0100 |
commit | 129f727e7b6215c88e623d31156e2c31346ecb21 (patch) | |
tree | f9b2bebcdc8ed385d81305d7b5fb2b46f8b1c1f1 /testing/prayer/sighandling.patch | |
parent | f55b3f371ed9c97416ff3257d7d1ac6251ad0c00 (diff) | |
download | aports-129f727e7b6215c88e623d31156e2c31346ecb21.tar.bz2 aports-129f727e7b6215c88e623d31156e2c31346ecb21.tar.xz |
testing/prayer: new aport
Diffstat (limited to 'testing/prayer/sighandling.patch')
-rw-r--r-- | testing/prayer/sighandling.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/testing/prayer/sighandling.patch b/testing/prayer/sighandling.patch new file mode 100644 index 0000000000..e7916ea80b --- /dev/null +++ b/testing/prayer/sighandling.patch @@ -0,0 +1,67 @@ +--- a/lib/os.h ++++ b/lib/os.h +@@ -44,6 +44,8 @@ BOOL os_signal_alarm_clear(void); + + BOOL os_signal_init(); + ++BOOL os_signal_hup_term_init(void (*hup_fn) (), void (*term_fn) ()); ++ + BOOL os_lock_exclusive(int fd); + + BOOL os_lock_shared(int fd); +--- a/servers/session_server.c ++++ b/servers/session_server.c +@@ -286,6 +286,7 @@ BOOL session_server(struct config *confi + fd_set readfds; + pid_t child; + unsigned long timeout = 0L; ++ BOOL sighup_seen = NIL; + + if (config->direct_enable) { + ssl_portlist +@@ -348,6 +349,18 @@ BOOL session_server(struct config *confi + } else { + rc = select(maxfd + 1, &readfds, NIL, NIL, NIL); + } ++ if (sighup_seen) { ++ log_misc("SIGHUP received - reexec daemon"); ++ close(sockfd); ++ if (config->direct_enable) { ++ /* Find some way to pass this information along ++ to the new invocation somehow later. */ ++ portlist_close_all(ssl_portlist); ++ portlist_close_all(plain_portlist); ++ } ++ log_misc_free(); ++ return (T); ++ } + } + while ((rc < 0) && (errno == EINTR)); + +--- a/shared/log.c ++++ b/shared/log.c +@@ -502,6 +502,13 @@ BOOL log_misc_init(struct config *config + return (log_open(log_misc_ptr, log_name)); + } + ++void log_misc_free() ++{ ++ if ((log_misc_ptr == NIL) || (log_misc_ptr->fd < 0)) ++ return; ++ log_free(log_misc_ptr); ++} ++ + /* log_misc_ping() ******************************************************* + * + * Reopen misc log file if required +--- a/shared/log.h ++++ b/shared/log.h +@@ -45,6 +45,8 @@ void log_record_peer_pid(struct log *log + BOOL + log_misc_init(struct config *config, char *progname, char *misc_log_name); + ++void log_misc_free(); ++ + BOOL log_misc_ping(); + + void log_misc(char *fmt, ...); |