Fixed possible race condition

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@728 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-05-27 09:13:56 +00:00
parent 3d25f7825a
commit 881cd23652

View File

@ -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;
}