diff options
| author | Frank Gevaerts <frank@gevaerts.be> | 2009-12-23 21:51:29 +0000 |
|---|---|---|
| committer | Frank Gevaerts <frank@gevaerts.be> | 2009-12-23 21:51:29 +0000 |
| commit | e0263b166c8e334c388655373f2144d9bc5184b4 (patch) | |
| tree | 328d8f6541c73e4c0b66362edaa794b88018b5db | |
| parent | 62166275596b10904e3a962c6b0e0cd448268b63 (diff) | |
| download | rockbox-e0263b166c8e334c388655373f2144d9bc5184b4.zip rockbox-e0263b166c8e334c388655373f2144d9bc5184b4.tar.gz rockbox-e0263b166c8e334c388655373f2144d9bc5184b4.tar.bz2 rockbox-e0263b166c8e334c388655373f2144d9bc5184b4.tar.xz | |
only get the file pointer if fd is actually valid.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24105 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/common/file.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index a7facc3..75adc87 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; |