diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-07-23 17:16:29 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-07-23 17:16:29 +0000 |
commit | bd7661b82698c88f08cb82e57cc229cd9df8a3d4 (patch) | |
tree | 2c2081d77362d9b82e6fe135f113bfd4918756bc /lib/mount.c | |
parent | 588653700e52d72c47c5d5915fc2143db6029474 (diff) | |
download | libfuse-bd7661b82698c88f08cb82e57cc229cd9df8a3d4.tar.gz |
clean up mount option passing
Diffstat (limited to 'lib/mount.c')
-rw-r--r-- | lib/mount.c | 22 |
1 files changed, 4 insertions, 18 deletions
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); } |