Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index a3226335..e6c784cc 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -64,7 +64,7 @@
* @param treename the name of the repository
* @return a pmdb_t* on success (the value), NULL on error
*/
-pmdb_t SYMEXPORT *alpm_db_register(char *treename)
+pmdb_t SYMEXPORT *alpm_db_register(const char *treename)
{
ALPM_LOG_FUNC;
@@ -74,14 +74,14 @@ pmdb_t SYMEXPORT *alpm_db_register(char *treename)
/* 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(treename, NULL));
+ return(_alpm_db_register(treename));
}
/** Unregister a package database
* @param db pointer to the package database to unregister
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_db_unregister(pmdb_t *db)
+int SYMEXPORT alpm_db_unregister(pmdb_t *db)
{
int found = 0;
@@ -126,7 +126,7 @@ int alpm_db_unregister(pmdb_t *db)
* @param url url of the server
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_db_setserver(pmdb_t *db, const char *url)
+int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
{
int found = 0;
@@ -597,7 +597,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles)
return(ret);
}
-pmdb_t *_alpm_db_register(const char *treename, alpm_cb_db_register callback)
+pmdb_t *_alpm_db_register(const char *treename)
{
struct stat buf;
pmdb_t *db;
@@ -626,6 +626,10 @@ pmdb_t *_alpm_db_register(const char *treename, alpm_cb_db_register callback)
/* make sure the database directory exists */
dbpath = alpm_option_get_dbpath();
+ if(!dbpath) {
+ _alpm_log(PM_LOG_WARNING, _("database path is undefined"));
+ RET_ERR(PM_ERR_DB_OPEN, NULL);
+ }
snprintf(path, PATH_MAX, "%s%s", dbpath, treename);
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_DEBUG, _("database directory '%s' does not exist, creating it"),
@@ -646,9 +650,6 @@ pmdb_t *_alpm_db_register(const char *treename, alpm_cb_db_register callback)
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
- /* Only call callback on NEW registration. */
- if(callback) callback(treename, db);
-
if(strcmp(treename, "local") == 0) {
handle->db_local = db;
} else {