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:
Dan McGee 2007-10-29 23:12:37 -05:00
parent 6af7dbcf72
commit be387148c9

View file

@ -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);
} }