Blame SOURCES/BZ-1967686-do-not-error-out-on-SIGINT.patch

d7fcff
From 9147d3b66e0a263c2eb427b7892b34c925363854 Mon Sep 17 00:00:00 2001
d7fcff
From: Michal Domonkos <mdomonko@redhat.com>
d7fcff
Date: Thu, 17 Feb 2022 17:36:00 +0100
d7fcff
Subject: [PATCH] Don't error out when command receives SIGINT
d7fcff
d7fcff
Interrupting a running command isn't really an execution problem so
d7fcff
don't print an error or return a non-zero exit status.
d7fcff
d7fcff
This is also how it worked in versions older than 2.0.
d7fcff
d7fcff
Resolves: rhbz#1967686
d7fcff
---
d7fcff
 src/fallback.c | 3 +++
d7fcff
 src/scllib.c   | 3 +++
d7fcff
 2 files changed, 6 insertions(+)
d7fcff
d7fcff
diff --git a/src/fallback.c b/src/fallback.c
d7fcff
index 4b9c8fd..c907a34 100644
d7fcff
--- a/src/fallback.c
d7fcff
+++ b/src/fallback.c
d7fcff
@@ -6,6 +6,7 @@
d7fcff
 #include <errno.h>
d7fcff
 #include <sys/stat.h>
d7fcff
 #include <dirent.h>
d7fcff
+#include <signal.h>
d7fcff
 
d7fcff
 #include "scllib.h"
d7fcff
 #include "sclmalloc.h"
d7fcff
@@ -229,6 +230,8 @@ scl_rc fallback_run_command(char * const colnames[], const char *cmd, bool exec)
d7fcff
         xasprintf(&bash_cmd, "/bin/bash %s", tmp);
d7fcff
         status = system(bash_cmd);
d7fcff
         if (status == -1 || !WIFEXITED(status)) {
d7fcff
+            if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
d7fcff
+                goto exit;
d7fcff
             debug("Problem with executing command \"%s\"\n", bash_cmd);
d7fcff
             ret = ERUN;
d7fcff
             goto exit;
d7fcff
diff --git a/src/scllib.c b/src/scllib.c
d7fcff
index a182194..2ba8df8 100644
d7fcff
--- a/src/scllib.c
d7fcff
+++ b/src/scllib.c
d7fcff
@@ -11,6 +11,7 @@
d7fcff
 #include <rpm/rpmcli.h>
d7fcff
 #include <errno.h>
d7fcff
 #include <wordexp.h>
d7fcff
+#include <signal.h>
d7fcff
 
d7fcff
 #include "config.h"
d7fcff
 #include "errors.h"
d7fcff
@@ -341,6 +342,8 @@ scl_rc run_command(char * const colnames[], const char *cmd, bool exec)
d7fcff
 
d7fcff
         status = system(cmd);
d7fcff
         if (status == -1 || !WIFEXITED(status)) {
d7fcff
+            if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
d7fcff
+                goto exit;
d7fcff
             debug("Problem with executing program \"%s\"\n", cmd);
d7fcff
             ret = ERUN;
d7fcff
             goto exit;
d7fcff
-- 
d7fcff
2.35.1
d7fcff