[pacman-dev] [PATCH] sync_cleandb: ensure stat call succeeds
24 Feb
2015
24 Feb
'15
4:06 p.m.
Signed-off-by: Allan McRae <allan@archlinux.org> --- src/pacman/sync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 91eca7e..0c3151e 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -94,7 +94,10 @@ static int sync_cleandb(const char *dbpath, int keep_used) snprintf(path, PATH_MAX, "%s%s", dbpath, dname); /* remove all non-skipped directories and non-database files */ - stat(path, &buf); + if(stat(path, &buf) == -1) { + pm_printf(ALPM_LOG_ERROR, _("could not remove %s: %s\n"), + path, strerror(errno)); + } if(S_ISDIR(buf.st_mode)) { if(rmrf(path)) { pm_printf(ALPM_LOG_ERROR, _("could not remove %s: %s\n"), -- 2.3.0
3573
Age (days ago)
3573
Last active (days ago)
0 comments
1 participants
participants (1)
-
Allan McRae