Blob Blame History Raw
--- elfutils-0.187/debuginfod/debuginfod-client.c	2022-05-11 15:47:19.769601219 +0200
+++ elfutils-0.187/debuginfod/debuginfod-client.c.curl	2022-05-11 15:47:05.809805287 +0200
@@ -85,6 +85,7 @@
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include <curl/curl.h>
+#include <signal.h>
 
 /* If fts.h is included before config.h, its indirect inclusions may not
    give us the right LFS aliases of these functions, so map them manually.  */
@@ -105,7 +106,24 @@
 static void
 libcurl_init(void)
 {
+  /* The RHEL7 version of libcurl will muck with signal masks, messing up,
+     e.g., gdb.  */
+  sigset_t original_mask;
+  struct sigaction original_actions[NSIG];
+
+  sigprocmask (0, NULL, &original_mask);
+
+  /* Some signal numbers in the range are invalid and might produce
+     an error (EINVAL).  Simply ignore those, this is best effort.  */
+  for (int i = 1; i < NSIG; ++i)
+    sigaction (i, NULL, &original_actions[i]);
+
   curl_global_init(CURL_GLOBAL_DEFAULT);
+
+  for (int i = 1; i < NSIG; ++i)
+    sigaction (i, &original_actions[i], NULL);
+
+  sigprocmask (SIG_SETMASK, &original_mask, NULL);
 }
 
 struct debuginfod_client