From 881cd236526db228d762310cc81938d043434d44 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 27 May 2002 09:13:56 +0000 Subject: Fixed possible race condition git-svn-id: svn://svn.rockbox.org/rockbox/trunk@728 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'firmware') diff --git a/firmware/common/file.c b/firmware/common/file.c index a513f5221f..4b7865d724 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; } -- cgit v1.2.3