From bd7661b82698c88f08cb82e57cc229cd9df8a3d4 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 23 Jul 2004 17:16:29 +0000 Subject: clean up mount option passing --- lib/mount.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'lib/mount.c') diff --git a/lib/mount.c b/lib/mount.c index 648dfbc..05dcb59 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -78,7 +78,7 @@ void fuse_unmount(const char *mountpoint) system(umount_cmd); } -int fuse_mount(const char *mountpoint, const char *args[]) +int fuse_mount(const char *mountpoint, const char *opts) { const char *mountprog = FUSERMOUNT_PROG; int fds[2], pid; @@ -101,28 +101,14 @@ int fuse_mount(const char *mountpoint, const char *args[]) if(pid == 0) { char env[10]; - char **newargv; - int numargs = 0; - int actr; - int i; - - if(args != NULL) - while(args[numargs] != NULL) - numargs ++; - - newargv = (char **) malloc((1 + numargs + 2) * sizeof(char *)); - actr = 0; - newargv[actr++] = strdup(mountprog); - for(i = 0; i < numargs; i++) - newargv[actr++] = strdup(args[i]); - newargv[actr++] = strdup(mountpoint); - newargv[actr++] = NULL; + const char *argv[] = {mountprog, opts ? "-o" : mountpoint, opts, + mountpoint, NULL}; close(fds[1]); fcntl(fds[0], F_SETFD, 0); snprintf(env, sizeof(env), "%i", fds[0]); setenv(FUSE_COMMFD_ENV, env, 1); - execvp(mountprog, newargv); + execvp(mountprog, (char **) argv); perror("fuse: failed to exec fusermount"); exit(1); } -- cgit v1.2.3