X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fsecure-umount.c;h=2220ed5e6c912b37b8eea6287f32ef55bbe83181;hb=a917f24ef7b003dcef54a3db2644cf9cb4bc2db2;hp=e2084bd4e7414f925e11822e6c342b89a224135d;hpb=0692b508de44595db941a2b98b5a73228a65e8fc;p=util-vserver.git diff --git a/util-vserver/src/secure-umount.c b/util-vserver/src/secure-umount.c index e2084bd..2220ed5 100644 --- a/util-vserver/src/secure-umount.c +++ b/util-vserver/src/secure-umount.c @@ -19,7 +19,8 @@ #ifdef HAVE_CONFIG_H # include #endif -#include "compat-pivot_root.h" + +#include "pathconfig.h" #include "wrappers.h" #include "util.h" @@ -52,6 +53,9 @@ showVersion() int main(int argc, char *argv[]) { char const * dir; + int root_fd; + int this_fd; + char * umount_cmd[] = { UMOUNT_PROG, "-l", "-n", ".", 0 }; if (argc<2) { WRITE_MSG(2, "Try '"); @@ -66,9 +70,16 @@ int main(int argc, char *argv[]) dir = argv[1]; if (strcmp(dir, "--")==0 && argc>=3) dir = argv[2]; + root_fd = Eopen("/", O_RDONLY, 0); + Echroot("."); + Echdir(dir); + this_fd = Eopen(".", O_RDONLY, 0); + Efchdir(root_fd); Echroot("."); - Echdir("/"); + Efchdir(this_fd); + + Eclose(root_fd); + Eclose(this_fd); - Eumount2(dir, 0); - return EXIT_SUCCESS; + Eexecv(umount_cmd[0], umount_cmd); }