Attempted mounting read-only after failed permission to read-write

If a partition image could not be opened read-write, retry as read-only
This commit is contained in:
Jean-Pierre André 2018-08-22 09:43:19 +02:00
parent d52b1ca929
commit 2514ce6a42
2 changed files with 4 additions and 1 deletions

View File

@ -143,6 +143,9 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags)
*(int*)dev->d_private = open(dev->d_name, flags);
if (*(int*)dev->d_private == -1) {
err = errno;
/* if permission error and rw, retry read-only */
if ((err == EACCES) && ((flags & O_RDWR) == O_RDWR))
err = EROFS;
goto err_out;
}
#ifdef HAVE_LINUX_FS_H

View File

@ -529,7 +529,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
dev->d_name);
goto error_exit;
} else {
ntfs_log_info("Can only open '%s' as read-only\n",
ntfs_log_info("Error opening '%s' read-write\n",
dev->d_name);
NVolSetReadOnly(vol);
}