* Fixed signal handling (kaoupload.c).
authorUrban Wallasch <urban.wallasch@freenet.de>
Thu, 22 Apr 2021 18:31:14 +0000 (20:31 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Thu, 22 Apr 2021 18:31:14 +0000 (20:31 +0200)
kaoupload.c

index 882a513b201b761875df1c1fcbfd461f55524224..e510bab4a6c2c74e46c03206fe36e858411f3054 100644 (file)
@@ -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" ) : "" );