diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-05-13 04:37:06 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-05-13 04:37:06 +0200 |
commit | 3b658ec79801e3998a898cbfce97530ae5abf61b (patch) | |
tree | 7cd8fcf2e1f36c2c274eb350c990722e7392bcca | |
parent | ingore quilt dir (diff) |
fixed exit-code after signal
-rw-r--r-- | debian/patches/fix-sighandler-return-code.patch | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/debian/patches/fix-sighandler-return-code.patch b/debian/patches/fix-sighandler-return-code.patch index 9a8240b..5f40062 100644 --- a/debian/patches/fix-sighandler-return-code.patch +++ b/debian/patches/fix-sighandler-return-code.patch @@ -7,8 +7,10 @@ Description: this fixes the return code when signals are caught * added systemd service file Author: Christian Pointner <equinox@spreadspace.org> ---- tcpproxy-1.1.orig/src/sig_handler.c -+++ tcpproxy-1.1/src/sig_handler.c +Index: tcpproxy/src/sig_handler.c +=================================================================== +--- tcpproxy.orig/src/sig_handler.c ++++ tcpproxy/src/sig_handler.c @@ -116,12 +116,12 @@ int signal_handle() for(sig=1; sig < NSIG; ++sig) { if(sigismember(&set, sig)) { @@ -28,9 +30,21 @@ Author: Christian Pointner <equinox@spreadspace.org> default: log_printf(WARNING, "unknown signal %d caught, ignoring", sig); break; } sigdelset(&set, sig); ---- tcpproxy-1.1.orig/src/tcpproxy.c -+++ tcpproxy-1.1/src/tcpproxy.c -@@ -73,8 +73,8 @@ int main_loop(options_t* opt, listeners_ +Index: tcpproxy/src/tcpproxy.c +=================================================================== +--- tcpproxy.orig/src/tcpproxy.c ++++ tcpproxy/src/tcpproxy.c +@@ -30,6 +30,9 @@ + #include <errno.h> + #include <string.h> + #include <sys/select.h> ++#include <sys/types.h> ++#include <unistd.h> ++#include <signal.h> + + #include "datatypes.h" + #include "options.h" +@@ -73,8 +76,8 @@ int main_loop(options_t* opt, listeners_ if(FD_ISSET(sig_fd, &readfds)) { return_value = signal_handle(); @@ -41,7 +55,7 @@ Author: Christian Pointner <equinox@spreadspace.org> if(opt->config_file_) { log_printf(NOTICE, "re-reading config file: %s", opt->config_file_); read_configfile(opt->config_file_, listeners); -@@ -82,9 +82,9 @@ int main_loop(options_t* opt, listeners_ +@@ -82,9 +85,9 @@ int main_loop(options_t* opt, listeners_ log_printf(NOTICE, "ignoring SIGHUP: no config file specified"); return_value = 0; @@ -53,3 +67,15 @@ Author: Christian Pointner <equinox@spreadspace.org> clients_print(&clients); } } +@@ -233,8 +236,10 @@ int main(int argc, char* argv[]) + log_printf(NOTICE, "normal shutdown"); + else if(ret < 0) + log_printf(NOTICE, "shutdown after error"); +- else ++ else { + log_printf(NOTICE, "shutdown after signal"); ++ kill(getpid(), ret); ++ } + + log_close(); + |