OSDN Git Service

Rejected implicit mounting read-only when hiberfile option is present
authorJean-Pierre André <jpandre@users.sourceforge.net>
Wed, 4 May 2016 07:39:48 +0000 (09:39 +0200)
committerJean-Pierre André <jpandre@users.sourceforge.net>
Wed, 4 May 2016 07:39:48 +0000 (09:39 +0200)
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
src/ntfs-3g.8.in
src/ntfs-3g.c

index 80c224f..5439b10 100644 (file)
@@ -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)
index 986b4e9..a3fb0da 100644 (file)
@@ -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 
index 4b4ec36..6b25f03 100644 (file)
@@ -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)