aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2013-07-15 20:37:47 +0200
committerTimo Weingärtner <timo@tiwe.de>2013-07-19 21:37:44 +0200
commitac2c716b4bdb463ba6dfd4a1b82595c3ea861d01 (patch)
tree890a0394433afe534ad36594cdad5cbbb15344fb
parent9e8adf8438d3ca343a9161725e6f0ff68e44832c (diff)
downloadssh-agent-filter-ac2c716b4bdb463ba6dfd4a1b82595c3ea861d01.tar.gz
improve debug mode
also clean up socket in debug mode also exit when catching SIGINT
-rw-r--r--ssh-agent-filter.C11
1 files changed, 5 insertions, 6 deletions
diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C
index 61acafe..4ebb204 100644
--- a/ssh-agent-filter.C
+++ b/ssh-agent-filter.C
@@ -326,7 +326,6 @@ void handle_client (int const sock) {
void sighandler (int sig) {
switch (sig) {
- case SIGINT:
case SIGPIPE:
break;
default:
@@ -363,12 +362,12 @@ int main (int const argc, char const * const * const argv) {
dup2(devnull, 1);
dup2(devnull, 2);
close(devnull);
-
- signal(SIGINT, sighandler);
- signal(SIGPIPE, sighandler);
- signal(SIGHUP, sighandler);
- signal(SIGTERM, sighandler);
}
+
+ signal(SIGINT, sighandler);
+ signal(SIGPIPE, sighandler);
+ signal(SIGHUP, sighandler);
+ signal(SIGTERM, sighandler);
int client_sock;
while ((client_sock = accept(listen_sock, nullptr, nullptr)) != -1) {