Fix loop mapping on readonly file.

This commit is contained in:
Milan Broz
2012-05-02 00:41:05 +02:00
parent 4b6ec2a8c2
commit a718369374
2 changed files with 4 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
2012-05-02 Milan Broz <gmazyland@gmail.com>
* Fix loop mapping on readonly file.
2012-04-09 Milan Broz <gmazyland@gmail.com>
* Fix header check to support old (cryptsetup 1.0.0) header alignment. (1.4.0)
* Version 1.4.2.

View File

@@ -99,7 +99,7 @@ int crypt_loop_attach(const char *loop, const char *file, int offset,
int loop_fd = -1, file_fd = -1, r = 1;
file_fd = open(file, (*readonly ? O_RDONLY : O_RDWR) | O_EXCL);
if (file_fd < 0 && errno == EROFS && !*readonly) {
if (file_fd < 0 && (errno == EROFS || errno == EACCES) && !*readonly) {
*readonly = 1;
file_fd = open(file, O_RDONLY | O_EXCL);
}