index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-03 15:24:01 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-07 11:37:05 -0500 |
commit | fb4b422fc4567238332050b9a6c8c1cac2a8f091 (patch) | |
tree | 047457f6cadf5493406b0ca4fa8c60230481d92d /lib/libalpm/handle.c | |
parent | 992fa50dfd4faba93e37364bded015ea04d1fe15 (diff) |
-rw-r--r-- | lib/libalpm/handle.c | 44 |
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index ccd13f11..80ad5601 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -313,7 +313,7 @@ static char *canonicalize_path(const char *path) { return new_path; } -int _alpm_set_directory_option(const char *value, +enum _pmerrno_t _alpm_set_directory_option(const char *value, char **storage, int must_exist) { struct stat st; @@ -322,19 +322,16 @@ int _alpm_set_directory_option(const char *value, path = value; if(!path) { - pm_errno = PM_ERR_WRONG_ARGS; - return -1; + return PM_ERR_WRONG_ARGS; } if(must_exist) { if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) { - pm_errno = PM_ERR_NOT_A_DIR; - return -1; + return PM_ERR_NOT_A_DIR; } real = calloc(PATH_MAX + 1, sizeof(char)); if(!realpath(path, real)) { free(real); - pm_errno = PM_ERR_NOT_A_DIR; - return -1; + return PM_ERR_NOT_A_DIR; } path = real; } @@ -347,39 +344,6 @@ int _alpm_set_directory_option(const char *value, return 0; } -int SYMEXPORT alpm_option_set_root(const char *root) -{ - ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); - - if(_alpm_set_directory_option(root, &(handle->root), 1)) { - return -1; - } - _alpm_log(PM_LOG_DEBUG, "option 'root' = %s\n", handle->root); - return 0; -} - -int SYMEXPORT alpm_option_set_dbpath(const char *dbpath) -{ - const char *lf = "db.lck"; - size_t lockfilelen; - - ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); - - if(_alpm_set_directory_option(dbpath, &(handle->dbpath), 1)) { - return -1; - } - _alpm_log(PM_LOG_DEBUG, "option 'dbpath' = %s\n", handle->dbpath); - - if(handle->lockfile) { - FREE(handle->lockfile); - } - lockfilelen = strlen(handle->dbpath) + strlen(lf) + 1; - handle->lockfile = calloc(lockfilelen, sizeof(char)); - snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf); - _alpm_log(PM_LOG_DEBUG, "option 'lockfile' = %s\n", handle->lockfile); - return 0; -} - int SYMEXPORT alpm_option_add_cachedir(const char *cachedir) { char *newcachedir; |