From 0d17a20a750c0cc8c3c0078a548140d433982972 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Wed, 22 Oct 2003 18:23:59 +0000 Subject: [PATCH] use real 'umount' program to unmount directories git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@281 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/secure-umount.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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); } -- 1.8.1.5