[pacman-dev] [PATCH 4/5] libalpm: set errno when setting parallel downloads with an invalid number

morganamilo morganamilo at archlinux.org
Tue Nov 24 12:39:07 UTC 2020


diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 1310601a..16d4beaa 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -857,9 +857,7 @@ int SYMEXPORT alpm_option_set_parallel_downloads(alpm_handle_t *handle,
 {
 	CHECK_HANDLE(handle, return -1);
 #ifdef HAVE_LIBCURL
-	if(num_streams < 1) {
-		return -1;
-	}
+	ASSERT(num_streams >= 1, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 	handle->parallel_downloads = num_streams;
 #else
 	(void)num_streams; /* silence unused variable warnings */
-- 
2.29.2


More information about the pacman-dev mailing list