X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsecure-mount.c;h=6dc2c41851a0ce121a0299cbbaa2d7757ad3bf16;hb=9cd5375cdc1c902da2e6a5cb70d01934a6b71d22;hp=a76f7a074ea0d9d1c011aa521ae1ede352995476;hpb=65ee8e8556e0c293b039fcea0cdcde40cf412483;p=util-vserver.git diff --git a/src/secure-mount.c b/src/secure-mount.c index a76f7a0..6dc2c41 100644 --- a/src/secure-mount.c +++ b/src/secure-mount.c @@ -436,6 +436,20 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt) perror("secure-mount: mount()"); return false; } + if ((mnt->flag & MS_BIND) && + (mnt->flag & ~(MS_BIND|MS_REC))) { + /* This is needed to put us in the new mountpoint */ + if (!secureChdir(mnt->dst, opt)) + return false; + if (mount(mnt->src, ".", + mnt->type ? mnt->type : "", + ((mnt->flag & ~(MS_BIND|MS_REC)) | + MS_REMOUNT), NULL) == -1 && + errno != EBUSY) { /* Returned on older kernels */ + perror("secure-mount: mount()"); + return false; + } + } } else if (!callExternalMount(mnt)) return false;