xbps-uunshare: chdir to the correct dir for bind mounts.

This commit is contained in:
Juan RP 2015-03-05 19:06:39 +01:00
parent a1d1b3e480
commit 26944cf6be

View File

@ -72,6 +72,8 @@ bindmount(const char *chrootdir, const char *dir, const char *dest)
char mountdir[PATH_MAX-1]; char mountdir[PATH_MAX-1];
snprintf(mountdir, sizeof(mountdir), "%s/%s", chrootdir, dest ? dest : dir); snprintf(mountdir, sizeof(mountdir), "%s/%s", chrootdir, dest ? dest : dir);
if (chdir(dir) == -1)
die("chdir to %s", chrootdir);
if (mount(".", mountdir, NULL, MS_BIND|MS_REC|MS_PRIVATE, NULL) == -1) if (mount(".", mountdir, NULL, MS_BIND|MS_REC|MS_PRIVATE, NULL) == -1)
die("Failed to bind mount %s at %s", dir, mountdir); die("Failed to bind mount %s at %s", dir, mountdir);
} }