From 832ee448ec543bcebcff391989963450c012dd80 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 18 Nov 2005 21:02:36 +0000 Subject: fix --- lib/mount.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'lib/mount.c') diff --git a/lib/mount.c b/lib/mount.c index 62e2b4a..787c448 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -70,13 +70,32 @@ static int receive_fd(int fd) void fuse_unmount(const char *mountpoint) { const char *mountprog = FUSERMOUNT_PROG; - char umount_cmd[1024]; + int pid; - snprintf(umount_cmd, sizeof(umount_cmd) - 1, "%s -u -q -z -- %s", - mountprog, mountpoint); +#ifdef HAVE_FORK + pid = fork(); +#else + pid = vfork(); +#endif + if(pid == -1) + return; + + if(pid == 0) { + const char *argv[32]; + int a = 0; - umount_cmd[sizeof(umount_cmd) - 1] = '\0'; - system(umount_cmd); + argv[a++] = mountprog; + argv[a++] = "-u"; + argv[a++] = "-q"; + argv[a++] = "-z"; + argv[a++] = "--"; + argv[a++] = mountpoint; + argv[a++] = NULL; + + execvp(mountprog, (char **) argv); + exit(1); + } + waitpid(pid, NULL, 0); } int fuse_mount(const char *mountpoint, const char *opts) -- cgit v1.2.3