projects
/
platform
/
upstream
/
cryptsetup.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Require only up to last keyslot area for header device (ignore data offset).
[platform/upstream/cryptsetup.git]
/
lib
/
utils_loop.c
diff --git
a/lib/utils_loop.c
b/lib/utils_loop.c
index
91cde56
..
6a4e11f
100644
(file)
--- a/
lib/utils_loop.c
+++ b/
lib/utils_loop.c
@@
-1,7
+1,7
@@
/*
* loopback block device utilities
*
/*
* loopback block device utilities
*
- * Copyright (C) 2011, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011
-2012
, Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@
-14,7
+14,7
@@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 5
1 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
*/
#include <string.h>
@@
-29,6
+29,16
@@
#include "utils_loop.h"
#include "utils_loop.h"
+#define LOOP_DEV_MAJOR 7
+
+#ifndef LO_FLAGS_AUTOCLEAR
+#define LO_FLAGS_AUTOCLEAR 4
+#endif
+
+#ifndef LOOP_CTL_GET_FREE
+#define LOOP_CTL_GET_FREE 0x4C82
+#endif
+
static char *crypt_loop_get_device_old(void)
{
char dev[20];
static char *crypt_loop_get_device_old(void)
{
char dev[20];
@@
-89,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);
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);
}
*readonly = 1;
file_fd = open(file, O_RDONLY | O_EXCL);
}