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>
This commit is contained in:
parent
819a0c2986
commit
7bcc2d9b23
1 changed files with 2 additions and 2 deletions
|
@ -210,11 +210,11 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
|
||||||
|
|
||||||
/* set variables here, do all output below */
|
/* set variables here, do all output below */
|
||||||
bdate = (time_t)alpm_pkg_get_builddate(pkg);
|
bdate = (time_t)alpm_pkg_get_builddate(pkg);
|
||||||
if(bdate) {
|
if(bdate != -1) {
|
||||||
strftime(bdatestr, 50, "%c", localtime(&bdate));
|
strftime(bdatestr, 50, "%c", localtime(&bdate));
|
||||||
}
|
}
|
||||||
idate = (time_t)alpm_pkg_get_installdate(pkg);
|
idate = (time_t)alpm_pkg_get_installdate(pkg);
|
||||||
if(idate) {
|
if(idate != -1) {
|
||||||
strftime(idatestr, 50, "%c", localtime(&idate));
|
strftime(idatestr, 50, "%c", localtime(&idate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue