summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2009-12-23 22:13:37 +0000
committerFrank Gevaerts <frank@gevaerts.be>2009-12-23 22:13:37 +0000
commit5509372f03e01235d4663d80bb769c52711688a9 (patch)
tree0266542d402b3e8c6bf2023f127bbeb225ddedc9
parente0263b166c8e334c388655373f2144d9bc5184b4 (diff)
downloadrockbox-5509372f03e01235d4663d80bb769c52711688a9.tar.gz
rockbox-5509372f03e01235d4663d80bb769c52711688a9.tar.bz2
rockbox-5509372f03e01235d4663d80bb769c52711688a9.zip
Make read() and write() return -1/EISDIR on directories
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24106 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 75adc8756f..a80aed5396 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -500,6 +500,11 @@ static int readwrite(int fd, void* buf, long count, bool write)
return -1;
}
+ if(file->attr & FAT_ATTR_DIRECTORY) {
+ errno = EISDIR;
+ return -1;
+ }
+
LDEBUGF( "readwrite(%d,%lx,%ld,%s)\n",
fd,(long)buf,count,write?"write":"read");