[pacman-dev,7/7] do not try to download an empty db list

Message ID 20210116072101.38203-7-andrew.gregory.8@gmail.com
State Accepted, archived
Headers show
Series [pacman-dev,1/7] pacman: indicate --overwrite takes a glob | expand

Commit Message

Andrew Gregory Jan. 16, 2021, 7:21 a.m. UTC
Starting the download process, even if there is nothing to actually
download, causes an error when pacman is built without curl and has no
XferCommand defined (like our test suite).

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
---
 lib/libalpm/be_sync.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 0a5cb7c2..91e5f5cf 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -198,6 +198,10 @@  int SYMEXPORT alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force)
 		payload->max_size = 128 * 1024 * 1024;
 		payloads = alpm_list_add(payloads, payload);
 	}
+	if(payloads == NULL) {
+		ret = 0;
+		goto cleanup;
+	}
 
 	event.type = ALPM_EVENT_DB_RETRIEVE_START;
 	EVENT(handle, &event);