From ab4bdea00fc622981e42c4189d7a174585d62f33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Pierre=20Andr=C3=A9?= Date: Wed, 4 May 2016 09:39:48 +0200 Subject: [PATCH] Rejected implicit mounting read-only when hiberfile option is present If the remove_hiberfile mount option is present, explicitly disallow the library from switching to a read-only mount. This is only to avoid confusion, as the remove_hiberfile is processed before taking the decision to fall back to read-only. --- src/lowntfs-3g.c | 3 ++- src/ntfs-3g.8.in | 4 ++-- src/ntfs-3g.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 80c224f8..5439b100 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -3941,7 +3941,8 @@ static int ntfs_open(const char *device) if (ctx->ro) flags |= NTFS_MNT_RDONLY; else - flags |= NTFS_MNT_MAY_RDONLY; + if (!ctx->hiberfile) + flags |= NTFS_MNT_MAY_RDONLY; if (ctx->recover) flags |= NTFS_MNT_RECOVER; if (ctx->hiberfile) diff --git a/src/ntfs-3g.8.in b/src/ntfs-3g.8.in index 986b4e97..a3fb0dad 100644 --- a/src/ntfs-3g.8.in +++ b/src/ntfs-3g.8.in @@ -185,8 +185,8 @@ etc. designate the same file). All files are displayed with lower case in directory listings. .TP .B remove_hiberfile -Unlike in case of read-only mount, the read-write mount is denied if -the NTFS volume is hibernated. One needs either to resume Windows and +When the NTFS volume is hibernated, a read-write mount is denied and +a read-only mount is forced. One needs either to resume Windows and shutdown it properly, or use this option which will remove the Windows hibernation file. Please note, this means that the saved Windows session will be completely lost. Use this option under your own diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 4b4ec363..6b25f036 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -3745,7 +3745,8 @@ static int ntfs_open(const char *device) if (ctx->ro) flags |= NTFS_MNT_RDONLY; else - flags |= NTFS_MNT_MAY_RDONLY; + if (!ctx->hiberfile) + flags |= NTFS_MNT_MAY_RDONLY; if (ctx->recover) flags |= NTFS_MNT_RECOVER; if (ctx->hiberfile) -- 2.11.0