From 26944cf6be3060ff4a940ddaab80f77cefc0b67b Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 5 Mar 2015 19:06:39 +0100 Subject: [PATCH] xbps-uunshare: chdir to the correct dir for bind mounts. --- bin/xbps-uunshare/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/xbps-uunshare/main.c b/bin/xbps-uunshare/main.c index 9fd6a801..87738558 100644 --- a/bin/xbps-uunshare/main.c +++ b/bin/xbps-uunshare/main.c @@ -72,6 +72,8 @@ bindmount(const char *chrootdir, const char *dir, const char *dest) char mountdir[PATH_MAX-1]; 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) die("Failed to bind mount %s at %s", dir, mountdir); }