From a4177d625c9a5e7925dfa5422a673a12c936c3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 17 May 2021 15:42:31 +0300 Subject: [PATCH] Made sure an error code is issued for failed mounts In case of failure to mount a file system, an error code is expected to indicate the failure reason. In an unclear case the error code was not set, so force an EIO when this happens. --- src/lowntfs-3g.c | 5 ++++- src/ntfs-3g.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index efc1a036..cfa61626 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -4368,9 +4368,12 @@ static int ntfs_open(const char *device) } errno = 0; + goto out; err_out: + if (!errno) /* Make sure to return an error */ + errno = EIO; +out : return ntfs_volume_error(errno); - } static void usage(void) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index fffe5f38..1f148ba0 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -4076,9 +4076,12 @@ static int ntfs_open(const char *device) } errno = 0; + goto out; err_out: + if (!errno) + errno = EIO; +out : return ntfs_volume_error(errno); - } static void usage(void)