diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/file.c | 9 |
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; |