summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-27 09:13:56 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-27 09:13:56 +0000
commit881cd236526db228d762310cc81938d043434d44 (patch)
treeeddc90a8dca1dbea6a3d3cb8b63d6796cc88c80c
parent3d25f7825a7e3df85a8077aec8b7bbce5fde8dfa (diff)
downloadrockbox-881cd236526db228d762310cc81938d043434d44.zip
rockbox-881cd236526db228d762310cc81938d043434d44.tar.gz
rockbox-881cd236526db228d762310cc81938d043434d44.tar.bz2
rockbox-881cd236526db228d762310cc81938d043434d44.tar.xz
Fixed possible race condition
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@728 a1c6a512-1295-4272-9138-f99709370657
-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 a513f52..4b7865d 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -72,6 +72,8 @@ int open(char* pathname, int flags)
return -1;
}
+ openfiles[fd].busy = true;
+
/* locate filename */
name=strrchr(pathname+1,'/');
if ( name ) {
@@ -87,6 +89,7 @@ int open(char* pathname, int flags)
if (!dir) {
DEBUGF("Failed opening dir\n");
errno = EIO;
+ openfiles[fd].busy = false;
return -1;
}
@@ -103,12 +106,12 @@ int open(char* pathname, int flags)
if ( !entry ) {
DEBUGF("Couldn't find %s in %s\n",name,pathname);
errno = ENOENT;
+ openfiles[fd].busy = false;
return -1;
}
openfiles[fd].cacheoffset = -1;
openfiles[fd].fileoffset = 0;
- openfiles[fd].busy = true;
return fd;
}