summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-03-10 19:47:59 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-03-10 19:47:59 +0000
commit5c8e82e097272d46caf139eda5bab58d2cbac9a0 (patch)
tree59e4cfaf47a329a5fa356a610004ef4554397e6d /firmware
parent5fb1e1024fb58d3704261545d63586f1e617f199 (diff)
downloadrockbox-5c8e82e097272d46caf139eda5bab58d2cbac9a0.tar.gz
rockbox-5c8e82e097272d46caf139eda5bab58d2cbac9a0.zip
You can't open() a directory as a file (at least not for writing)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4359 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 3a91bda876..5c1db105f4 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -160,6 +160,13 @@ int open(const char* pathname, int flags)
160 closedir(dir); 160 closedir(dir);
161 return -7; 161 return -7;
162 } 162 }
163 } else {
164 if(file->write && (file->attr & FAT_ATTR_DIRECTORY)) {
165 errno = EISDIR;
166 file->busy = false;
167 closedir(dir);
168 return -8;
169 }
163 } 170 }
164 closedir(dir); 171 closedir(dir);
165 172
@@ -169,7 +176,7 @@ int open(const char* pathname, int flags)
169 if (file->write && (flags & O_APPEND)) { 176 if (file->write && (flags & O_APPEND)) {
170 rc = lseek(fd,0,SEEK_END); 177 rc = lseek(fd,0,SEEK_END);
171 if (rc < 0 ) 178 if (rc < 0 )
172 return rc * 10 - 8; 179 return rc * 10 - 9;
173 } 180 }
174 181
175 return fd; 182 return fd;