diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-28 19:46:09 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-28 19:46:09 -0500 |
commit | a12a4ea3960c98817aa60df5a8879d118a16e2a7 (patch) | |
tree | 6f7eeb55b12c64efec4ce4d0079dc83be9632a6d /lib/libalpm | |
parent | 455ca55f4efecf48bf86904e4a67a4b124cf1838 (diff) | |
download | pacman-a12a4ea3960c98817aa60df5a8879d118a16e2a7.tar.xz |
Check local database status flag in db_write sanity check block
Do all the checks at once; this also avoids the 'return' call after we
have allocated memory for "pkgpath" as well as tweaked the umask.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/be_local.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index f53bd640..1a46dfdf 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -750,7 +750,7 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq int retval = 0; char *pkgpath = NULL; - if(db == NULL || info == NULL) { + if(db == NULL || info == NULL || !(db->status & DB_STATUS_LOCAL)) { return -1; } @@ -759,10 +759,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq /* make sure we have a sane umask */ oldmask = umask(0022); - if(strcmp(db->treename, "local") != 0) { - return -1; - } - /* DESC */ if(inforeq & INFRQ_DESC) { _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n", |