X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Futils_loop.c;h=6a4e11f4380b8e49d2d5210d7e4c2bbd7d7b4ed8;hb=5c7954a0c7bea6d98919d2f1d7e135afd37bb9c0;hp=eb9fbbbda2827562a8423e6a0b3cb43995eae863;hpb=7835b365a730ebc721460166cce9a03cabde4677;p=platform%2Fupstream%2Fcryptsetup.git diff --git a/lib/utils_loop.c b/lib/utils_loop.c index eb9fbbb..6a4e11f 100644 --- a/lib/utils_loop.c +++ b/lib/utils_loop.c @@ -1,7 +1,7 @@ /* * 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 @@ -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); }