From 4c562bf25d4aa01d364a8c30f1315705f932ec72 Mon Sep 17 00:00:00 2001 From: Vassili Tchersky Date: Mon, 17 Feb 2025 08:54:45 +0100 Subject: [PATCH] mount_bsd: Show errors when syscalls failed Log on unmount() and close() failure Signed-off-by: Vassili Tchersky --- lib/mount_bsd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c index ba17240..0e841df 100644 --- a/lib/mount_bsd.c +++ b/lib/mount_bsd.c @@ -128,8 +128,11 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key, void fuse_kern_unmount(const char *mountpoint, int fd) { - close(fd); - unmount(mountpoint, MNT_FORCE); + if (close(fd) < 0) + fuse_log(FUSE_LOG_ERR, "closing FD %d failed: %s", fd, strerror(errno)); + if (unmount(mountpoint, MNT_FORCE) < 0) + fuse_log(FUSE_LOG_ERR, "unmounting %s failed: %s", + mountpoint, strerror(errno)); } static int fuse_mount_core(const char *mountpoint, const char *opts) @@ -220,7 +223,8 @@ mount: if (waitpid(cpid, &status, 0) == -1 || WEXITSTATUS(status) != 0) { perror("fuse: failed to mount file system"); - close(fd); + if (close(fd) < 0) + perror("fuse: closing FD"); return -1; } -- 2.30.2