index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/alpm.c | 4 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 2 | ||||
-rw-r--r-- | lib/libalpm/be_local.c | 7 | ||||
-rw-r--r-- | lib/libalpm/db.c | 15 |
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 2a9f4605..7c3bfc26 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -54,6 +54,10 @@ int SYMEXPORT alpm_initialize(void) if(handle == NULL) { RET_ERR(PM_ERR_MEMORY, -1); } + if(_alpm_db_register_local() == NULL) { + /* error code should be set */ + return(-1); + } #ifdef ENABLE_NLS bindtextdomain("libalpm", LOCALEDIR); diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index a540bc4f..95482f07 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -174,8 +174,6 @@ typedef enum _pmpkgreason_t { * Databases */ -/* Preferred interfaces db_register_local and db_register_sync */ -pmdb_t *alpm_db_register_local(void); pmdb_t *alpm_db_register_sync(const char *treename); int alpm_db_unregister(pmdb_t *db); int alpm_db_unregister_all(void); diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index ea59ceca..9602c825 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -400,7 +400,7 @@ static int local_db_populate(pmdb_t *db) pkg = _alpm_pkg_new(); if(pkg == NULL) { closedir(dbdir); - return(-1); + RET_ERR(PM_ERR_MEMORY, -1); } /* split the db entry name */ if(_alpm_splitname(name, pkg) != 0) { @@ -900,11 +900,6 @@ pmdb_t *_alpm_db_register_local(void) ALPM_LOG_FUNC; - if(handle->db_local != NULL) { - _alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB\n")); - RET_ERR(PM_ERR_DB_NOT_NULL, NULL); - } - _alpm_log(PM_LOG_DEBUG, "registering local database\n"); db = _alpm_db_new("local", 1); diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index bf9a70d4..c80dcbb8 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -64,21 +64,6 @@ pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename) return(_alpm_db_register_sync(treename)); } -/** Register the local package database. - * @return a pmdb_t* representing the local database, or NULL on error - */ -pmdb_t SYMEXPORT *alpm_db_register_local(void) -{ - ALPM_LOG_FUNC; - - /* Sanity checks */ - ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL)); - /* Do not register a database if a transaction is on-going */ - ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, NULL)); - - return(_alpm_db_register_local()); -} - /* Helper function for alpm_db_unregister{_all} */ void _alpm_db_unregister(pmdb_t *db) { |