From 5e97a1eb39a613936978ad03fdbf0c84fd366259 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 22 May 2015 12:18:54 +0200 Subject: [PATCH] xbps_pkgdb_update: return EINVAL if pkgdb cannot be internalized. --- lib/pkgdb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pkgdb.c b/lib/pkgdb.c index 92ff1325..d39664f6 100644 --- a/lib/pkgdb.c +++ b/lib/pkgdb.c @@ -235,10 +235,14 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush, bool update) /* update copy in memory */ if ((xhp->pkgdb = xbps_dictionary_internalize_from_file(xhp->pkgdb_plist)) == NULL) { - if (errno == ENOENT) + rv = errno; + if (!rv) + rv = EINVAL; + + if (rv == ENOENT) xhp->pkgdb = xbps_dictionary_create(); else - xbps_error_printf("cannot access to pkgdb: %s\n", strerror(errno)); + xbps_error_printf("cannot access to pkgdb: %s\n", strerror(rv)); cached_rv = rv = errno; }