From 07a1292721c62f44d89a9fe6a0b093b5e6865b8a Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 8 Aug 2011 12:24:43 -0500 Subject: Check return value of rename() calls We did a good job checking this in add.c, but not necessarily anywhere else. Fix this up by adding checks into dload.c, remove.c, and conf.c in the frontend. Also add loggers where appropriate and make the message syntax more consistent. Signed-off-by: Dan McGee --- src/pacman/conf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/pacman') diff --git a/src/pacman/conf.c b/src/pacman/conf.c index a5804066..29e835ce 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -184,10 +184,14 @@ static int download_with_xfercommand(const char *url, const char *localpath, ret = -1; } else { /* download was successful */ + ret = 0; if(usepart) { - rename(tempfile, destfile); + if(rename(tempfile, destfile)) { + pm_printf(ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"), + tempfile, destfile, strerror(errno)); + ret = -1; + } } - ret = 0; } cleanup: -- cgit v1.2.3-24-g4f1b