aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/fusermount.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/util/fusermount.c b/util/fusermount.c
index 06f2461..57bf3ed 100644
--- a/util/fusermount.c
+++ b/util/fusermount.c
@@ -1453,6 +1453,16 @@ int main(int argc, char *argv[])
}
cfd = atoi(commfd);
+ {
+ struct stat statbuf;
+ fstat(cfd, &statbuf);
+ if(!S_ISSOCK(statbuf.st_mode)) {
+ fprintf(stderr,
+ "%s: file descriptor %i is not a socket, can't send fuse fd\n",
+ progname, cfd);
+ goto err_out;
+ }
+ }
if (setup_auto_unmount_only)
goto wait_for_auto_unmount;
@@ -1462,8 +1472,10 @@ int main(int argc, char *argv[])
goto err_out;
res = send_fd(cfd, fd);
- if (res == -1)
+ if (res != 0) {
+ umount2(mnt, MNT_DETACH); /* lazy umount */
goto err_out;
+ }
close(fd);
if (!auto_unmount) {