libalpm/handle.c: make realpath() call portable
BSD didn't support the NULL second argument GNU extension, so do it the old fashioned way. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
6af7dbcf72
commit
be387148c9
1 changed files with 3 additions and 4 deletions
|
@ -285,10 +285,9 @@ int SYMEXPORT alpm_option_set_root(const char *root)
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
pm_errno = PM_ERR_NOT_A_DIR;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
/* According to the man page, realpath is safe to use IFF the second arg is
|
|
||||||
* NULL. */
|
realroot = calloc(PATH_MAX+1, sizeof(char));
|
||||||
realroot = realpath(root, NULL);
|
if(!realpath(root, realroot)) {
|
||||||
if(!realroot) {
|
|
||||||
pm_errno = PM_ERR_NOT_A_DIR;
|
pm_errno = PM_ERR_NOT_A_DIR;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue