[pacman-dev] [PATCH] libalpm: Set ret correctly in download_internal()

Lukas Fleischer archlinux at cryptocrack.de
Sun Jul 24 07:52:05 EDT 2011


Immediately jump to the cleanup code after setting the return code to -1
in case rename() fails. Otherwise, it will be reset to 0 right after we
leave the if branch.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
Just spotted this one in maint. I realized the download_internal() code
was completely refactored in master; the only reason I submit this is to
fix this minor issue in case there will be another maintenance release
before pacman hits the big 4.0.0. If there isn't going to be such a
thing, you might ignore this or not.

 lib/libalpm/dload.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index a98d84a..e3d30f2 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -308,6 +308,7 @@ static int download_internal(const char *url, const char *localpath,
 		_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
 				tempfile, destfile, strerror(errno));
 		ret = -1;
+		goto cleanup;
 	}
 	ret = 0;
 
-- 
1.7.6



More information about the pacman-dev mailing list