createrepo_c: Add temporary blocking of SIGINT to prevent race condition.
authorTomas Mlcoch <tmlcoch@redhat.com>
Wed, 29 May 2013 13:15:14 +0000 (15:15 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Wed, 29 May 2013 13:15:14 +0000 (15:15 +0200)
src/createrepo_c.c

index d79e7bb..e7f7c01 100644 (file)
@@ -640,6 +640,12 @@ main(int argc, char **argv)
         tmp_out_repo = g_strconcat(out_dir, ".repodata/", NULL);
     }
 
+    // Block SIGINT
+
+    sigset_t intmask;
+    sigemptyset(&intmask);
+    sigaddset(&intmask, SIGINT);
+    sigprocmask(SIG_BLOCK, &intmask, NULL);
 
     // Check if tmp_out_repo exists & Create tmp_out_repo dir
 
@@ -670,6 +676,12 @@ main(int argc, char **argv)
         exit(1);
     }
 
+    // Unblock SIGINT
+
+    sigemptyset(&intmask);
+    sigaddset(&intmask, SIGINT);
+    sigprocmask(SIG_UNBLOCK, &intmask, NULL);
+
 
     // Open package list