Fix chdir() when rootdir it's an empty string.

--HG--
extra : convert_revision : bb7847fc538401d8c585bcb75114956f879077d3
This commit is contained in:
Juan RP 2009-04-05 12:41:40 +02:00
parent 4bf5c5f750
commit 161f97ce97
2 changed files with 6 additions and 0 deletions

View File

@ -219,6 +219,9 @@ xbps_remove_binary_pkg(const char *pkgname, bool update)
assert(pkgname != NULL); assert(pkgname != NULL);
if (strcmp(rootdir, "") == 0)
rootdir = "/";
if (rootdir) { if (rootdir) {
if (chdir(rootdir) == -1) if (chdir(rootdir) == -1)
return errno; return errno;

View File

@ -140,6 +140,9 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
rootdir = xbps_get_rootdir(); rootdir = xbps_get_rootdir();
flags = xbps_get_flags(); flags = xbps_get_flags();
if (strcmp(rootdir, "") == 0)
rootdir = "/";
if (rootdir) { if (rootdir) {
if (chdir(rootdir) == -1) if (chdir(rootdir) == -1)
return errno; return errno;