Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 142 | magnus | 1 | --- a/lib/os.h |
| 2 | +++ b/lib/os.h |
||
| 3 | magnus | 3 | @@ -44,6 +44,8 @@ BOOL os_signal_alarm_clear(void); |
| 4 | |||
| 5 | BOOL os_signal_init(); |
||
| 6 | |||
| 7 | +BOOL os_signal_hup_term_init(void (*hup_fn) (), void (*term_fn) ()); |
||
| 8 | + |
||
| 9 | BOOL os_lock_exclusive(int fd); |
||
| 10 | |||
| 11 | BOOL os_lock_shared(int fd); |
||
| 142 | magnus | 12 | --- a/servers/session_server.c |
| 13 | +++ b/servers/session_server.c |
||
| 14 | @@ -286,6 +286,7 @@ BOOL session_server(struct config *confi |
||
| 3 | magnus | 15 | fd_set readfds; |
| 16 | pid_t child; |
||
| 17 | unsigned long timeout = 0L; |
||
| 18 | + BOOL sighup_seen = NIL; |
||
| 19 | |||
| 20 | if (config->direct_enable) { |
||
| 21 | ssl_portlist |
||
| 142 | magnus | 22 | @@ -348,6 +349,18 @@ BOOL session_server(struct config *confi |
| 3 | magnus | 23 | } else { |
| 24 | rc = select(maxfd + 1, &readfds, NIL, NIL, NIL); |
||
| 25 | } |
||
| 26 | + if (sighup_seen) { |
||
| 27 | + log_misc("SIGHUP received - reexec daemon"); |
||
| 28 | + close(sockfd); |
||
| 29 | + if (config->direct_enable) { |
||
| 30 | + /* Find some way to pass this information along |
||
| 31 | + to the new invocation somehow later. */ |
||
| 32 | + portlist_close_all(ssl_portlist); |
||
| 33 | + portlist_close_all(plain_portlist); |
||
| 34 | + } |
||
| 35 | + log_misc_free(); |
||
| 36 | + return (T); |
||
| 37 | + } |
||
| 38 | } |
||
| 39 | while ((rc < 0) && (errno == EINTR)); |
||
| 40 | |||
| 142 | magnus | 41 | --- a/shared/log.c |
| 42 | +++ b/shared/log.c |
||
| 3 | magnus | 43 | @@ -502,6 +502,13 @@ BOOL log_misc_init(struct config *config |
| 44 | return (log_open(log_misc_ptr, log_name)); |
||
| 45 | } |
||
| 46 | |||
| 47 | +void log_misc_free() |
||
| 48 | +{ |
||
| 49 | + if ((log_misc_ptr == NIL) || (log_misc_ptr->fd < 0)) |
||
| 50 | + return; |
||
| 51 | + log_free(log_misc_ptr); |
||
| 52 | +} |
||
| 53 | + |
||
| 54 | /* log_misc_ping() ******************************************************* |
||
| 55 | * |
||
| 56 | * Reopen misc log file if required |
||
| 142 | magnus | 57 | --- a/shared/log.h |
| 58 | +++ b/shared/log.h |
||
| 3 | magnus | 59 | @@ -45,6 +45,8 @@ void log_record_peer_pid(struct log *log |
| 60 | BOOL |
||
| 61 | log_misc_init(struct config *config, char *progname, char *misc_log_name); |
||
| 62 | |||
| 63 | +void log_misc_free(); |
||
| 64 | + |
||
| 65 | BOOL log_misc_ping(); |
||
| 66 | |||
| 67 | void log_misc(char *fmt, ...); |