aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoman Bogorodskiy <bogorodskiy@gmail.com>2018-11-11 14:46:14 +0400
committerNikolaus Rath <Nikolaus@rath.org>2018-11-11 19:40:25 +0000
commit11d9ed614f9000cff349f077983e83b7901e7ed2 (patch)
tree98c535713cd93e234593b50b8c9bb915e4e147a6 /lib
parent70e25ea74e011d73887f4f66842b204fb4504c97 (diff)
downloadlibfuse-11d9ed614f9000cff349f077983e83b7901e7ed2.tar.gz
Fix mounting on FreeBSD
Currently, mounting on FreeBSD fails like this: mount_fusefs: ZZZZ<snip> on /mountpoint: No such file or directory This happens because right after doing argv[a++] = fdnam it's getting freed before calling execvp(). So move this free() call after execvp(). Also, when asprintf() fails for fdnam, close device fd before calling exit().
Diffstat (limited to 'lib')
-rw-r--r--lib/mount_bsd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c
index 94a11f7..cbd3ced 100644
--- a/lib/mount_bsd.c
+++ b/lib/mount_bsd.c
@@ -222,6 +222,7 @@ mount:
if(ret == -1)
{
perror("fuse: failed to assemble mount arguments");
+ close(fd);
exit(1);
}
}
@@ -232,14 +233,11 @@ mount:
argv[a++] = opts;
}
argv[a++] = fdnam;
-
- if(ret != -1)
- free(fdnam);
-
argv[a++] = mountpoint;
argv[a++] = NULL;
execvp(mountprog, (char **) argv);
perror("fuse: failed to exec mount program");
+ free(fdnam);
exit(1);
}