aboutsummaryrefslogtreecommitdiff
path: root/lib/mount.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-11-18 21:02:36 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-11-18 21:02:36 +0000
commit832ee448ec543bcebcff391989963450c012dd80 (patch)
tree3dddf1848c71aafc5b21550ed7e87d4c34607d79 /lib/mount.c
parent9c2ccb43c3cc960334e2ab0069501dc583c7dbf7 (diff)
fix
Diffstat (limited to 'lib/mount.c')
-rw-r--r--lib/mount.c29
1 files changed, 24 insertions, 5 deletions
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)