summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index a7facc3d32..75adc8756f 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -485,13 +485,16 @@ static int readwrite(int fd, void* buf, long count, bool write)
{
long sectors;
long nread=0;
- struct filedesc* file = &openfiles[fd];
+ struct filedesc* file;
int rc;
if (fd < 0 || fd > MAX_OPEN_FILES-1) {
errno = EINVAL;
return -1;
}
+
+ file = &openfiles[fd];
+
if ( !file->busy ) {
errno = EBADF;
return -1;