[PATCH] Correctly handle failure in getting build or install dates
alpm_pkg_get_builddate() and alpm_pkg_get_installdate() both return -1 on error. Correctly handle the error condition in pacman. Signed-off-by: Allan McRae <allan@archlinux.org> --- src/pacman/package.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pacman/package.c b/src/pacman/package.c index f2b6fa19..4fcc11f2 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -210,11 +210,11 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) /* set variables here, do all output below */ bdate = (time_t)alpm_pkg_get_builddate(pkg); - if(bdate) { + if(bdate != -1) { strftime(bdatestr, 50, "%c", localtime(&bdate)); } idate = (time_t)alpm_pkg_get_installdate(pkg); - if(idate) { + if(idate != -1) { strftime(idatestr, 50, "%c", localtime(&idate)); } -- 2.37.0
participants (1)
-
Allan McRae