From: Urban Wallasch Date: Thu, 22 Apr 2021 18:31:14 +0000 (+0200) Subject: * Fixed signal handling (kaoupload.c). X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=22bb8fdc11245952d987d750f41e75a6b9769074;p=kaotools.git * Fixed signal handling (kaoupload.c). --- diff --git a/kaoupload.c b/kaoupload.c index 882a513..e510bab 100644 --- a/kaoupload.c +++ b/kaoupload.c @@ -44,7 +44,7 @@ struct membuf_t { }; -static sig_atomic_t gotsig = 0; +static volatile sig_atomic_t gotsig = 0; static void sig_handler( int signum ){ gotsig = signum; @@ -381,9 +381,12 @@ int main( int argc, char *argv[] ) { int c; char confpath[PATH_MAX]; - signal( SIGINT, sig_handler ); - signal( SIGTERM, sig_handler ); - signal( SIGHUP, sig_handler ); + signal( SIGHUP, sig_handler ); // 1 + signal( SIGINT, sig_handler ); // 2 + signal( SIGQUIT, sig_handler ); // 3 + signal( SIGABRT, sig_handler ); // 6 + signal( SIGTERM, sig_handler ); // 15 + signal( SIGPIPE, SIG_IGN ); // better safe than sorry cfg.user = strdup( getenv( "USER" ) ? getenv( "USER" ) : "" ); cfg.pass = strdup( getenv( "PASS" ) ? getenv( "PASS" ) : "" );