* Fixed the handle realroot stuff

* Added some {}
This commit is contained in:
Aaron Griffin 2007-03-04 09:16:28 +00:00
parent cdb46ef3fa
commit 28b2dbb52c
2 changed files with 8 additions and 5 deletions

View file

@ -155,13 +155,13 @@ void alpm_option_set_root(const char *root)
/* According to the man page, realpath is safe to use IFF the second arg is /* According to the man page, realpath is safe to use IFF the second arg is
* NULL. */ * NULL. */
char *realroot = realpath(root, NULL); char *realroot = realpath(root, NULL);
if(!realroot) { if(realroot) {
realroot = root; root = realroot;
} else {
_alpm_log(PM_LOG_ERROR, _("cannot canonicalize specified root path '%s'"), root); _alpm_log(PM_LOG_ERROR, _("cannot canonicalize specified root path '%s'"), root);
} }
/* check again, in case both are null */ if(root) {
if(realroot) {
/* verify root ends in a '/' */ /* verify root ends in a '/' */
int rootlen = strlen(realroot); int rootlen = strlen(realroot);
if(realroot[rootlen-1] != '/') { if(realroot[rootlen-1] != '/') {
@ -172,6 +172,8 @@ void alpm_option_set_root(const char *root)
handle->root[rootlen-1] = '/'; handle->root[rootlen-1] = '/';
_alpm_log(PM_LOG_DEBUG, _("option 'root' = %s"), handle->root); _alpm_log(PM_LOG_DEBUG, _("option 'root' = %s"), handle->root);
}
if(realroot) {
free(realroot); free(realroot);
} }
} }

View file

@ -434,8 +434,9 @@ int main(int argc, char *argv[])
} }
/* workaround for tr_TR */ /* workaround for tr_TR */
if(lang && !strcmp(lang, "tr_TR")) if(lang && !strcmp(lang, "tr_TR")) {
setlocale(LC_CTYPE, "C"); setlocale(LC_CTYPE, "C");
}
bindtextdomain("pacman", "/usr/share/locale"); bindtextdomain("pacman", "/usr/share/locale");
textdomain("pacman"); textdomain("pacman");