Added strerror() output on unlink failure

This commit is contained in:
Aaron Griffin 2007-01-18 16:04:05 +00:00
parent 1bea7706ae
commit f6a76dac12

View file

@ -37,6 +37,8 @@
#include <fcntl.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <errno.h>
#include <libintl.h>
/* pacman */
#include "list.h"
@ -224,8 +226,8 @@ static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_t *targ,
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - _alpm_list_count(targ) + 1));
++(*position);
}
if ( unlink(file) ) {
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
if (unlink(file) == -1) {
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), file, strerror(errno));
}
}
}