diff mbox series

downloader: ignore SIGPIPE as other processes

Message ID 20231127122308.36380-1-stefano.babic@swupdate.org
State Accepted
Headers show
Series downloader: ignore SIGPIPE as other processes | expand

Commit Message

Stefano Babic Nov. 27, 2023, 12:23 p.m. UTC
Avoid that the downloader is closed when SIGPIPE is intercepted.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 corelib/downloader.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/corelib/downloader.c b/corelib/downloader.c
index ac138f85..57e972af 100644
--- a/corelib/downloader.c
+++ b/corelib/downloader.c
@@ -9,6 +9,7 @@ 
 #include <errno.h>
 #include <getopt.h>
 #include <json-c/json.h>
+#include <signal.h>
 
 #include "util.h"
 #include "network_ipc.h"
@@ -266,6 +267,7 @@  int start_download_server(const char *fname, int argc, char *argv[])
 	 * it is safe to call ipc_thread_fn() directly without spawning
 	 * a new thread. Function dows not return
 	 */
+	signal(SIGPIPE, SIG_IGN);
 	ipc_thread_fn(download_server_ipc);
 
 	/*