diff mbox

[pacman-dev,v2] alpm: Fix SIGINT handling re: aborting download

Message ID 20181017151101.22001-1-jjk@jjacky.com
State Accepted, archived
Delegated to: Andrew Gregory
Headers show

Commit Message

Olivier Brunel Oct. 17, 2018, 3:11 p.m. UTC
Upon receiving SIGINT a flag is set to abort the (curl) download.
However, since it was never reset/initialized, if a front-end doesn't
actually exit on SIGINT, and later tries any operation that needs to
perform a new download, said download would always get aborted right
away due to the flag not having been reset.

---

v2: Correctly reset variable before setting signal handler

Signed-off-by: Olivier Brunel <jjk@jjacky.com>
---
 lib/libalpm/dload.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index cca39470..4d0adb19 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -431,6 +431,7 @@  static int curl_download_internal(struct dload_payload *payload,
 	/* Ignore any SIGPIPE signals. With libcurl, these shouldn't be happening,
 	 * but better safe than sorry. Store the old signal handler first. */
 	mask_signal(SIGPIPE, SIG_IGN, &orig_sig_pipe);
+	dload_interrupted = 0;
 	mask_signal(SIGINT, &inthandler, &orig_sig_int);
 
 	/* perform transfer */