OSDN Git Service
(root)
/
android-x86
/
external-exfat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7f46abf
)
Set errno to EROFS on failure to open the device in RW mode.
author
relan
<relan@users.noreply.github.com>
Sun, 1 Jun 2014 19:28:12 +0000
(19:28 +0000)
committer
relan
<relan@users.noreply.github.com>
Mon, 24 Aug 2015 05:26:16 +0000
(08:26 +0300)
libexfat/io.c
patch
|
blob
|
history
diff --git
a/libexfat/io.c
b/libexfat/io.c
index
2bdfc43
..
ad71036
100644
(file)
--- a/
libexfat/io.c
+++ b/
libexfat/io.c
@@
-65,12
+65,20
@@
static int open_rw(const char* spec)
int ro = 0;
/*
- This
ioctl
is needed because after "blockdev --setro" kernel still
+ This
code
is needed because after "blockdev --setro" kernel still
allows to open the device in read-write mode but fails writes.
*/
- if (fd != -1 && ioctl(fd, BLKROGET, &ro) == 0 && ro)
+ if (fd == -1)
+ return -1;
+ if (ioctl(fd, BLKROGET, &ro) != 0)
+ {
+ close(fd);
+ return -1;
+ }
+ if (ro)
{
close(fd);
+ errno = EROFS;
return -1;
}
#endif