diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-05-27 09:13:56 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-05-27 09:13:56 +0000 |
commit | 881cd236526db228d762310cc81938d043434d44 (patch) | |
tree | eddc90a8dca1dbea6a3d3cb8b63d6796cc88c80c /firmware/common/file.c | |
parent | 3d25f7825a7e3df85a8077aec8b7bbce5fde8dfa (diff) | |
download | rockbox-881cd236526db228d762310cc81938d043434d44.tar.gz rockbox-881cd236526db228d762310cc81938d043434d44.zip |
Fixed possible race condition
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@728 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/file.c')
-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 a513f5221f..4b7865d724 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -72,6 +72,8 @@ int open(char* pathname, int flags) | |||
72 | return -1; | 72 | return -1; |
73 | } | 73 | } |
74 | 74 | ||
75 | openfiles[fd].busy = true; | ||
76 | |||
75 | /* locate filename */ | 77 | /* locate filename */ |
76 | name=strrchr(pathname+1,'/'); | 78 | name=strrchr(pathname+1,'/'); |
77 | if ( name ) { | 79 | if ( name ) { |
@@ -87,6 +89,7 @@ int open(char* pathname, int flags) | |||
87 | if (!dir) { | 89 | if (!dir) { |
88 | DEBUGF("Failed opening dir\n"); | 90 | DEBUGF("Failed opening dir\n"); |
89 | errno = EIO; | 91 | errno = EIO; |
92 | openfiles[fd].busy = false; | ||
90 | return -1; | 93 | return -1; |
91 | } | 94 | } |
92 | 95 | ||
@@ -103,12 +106,12 @@ int open(char* pathname, int flags) | |||
103 | if ( !entry ) { | 106 | if ( !entry ) { |
104 | DEBUGF("Couldn't find %s in %s\n",name,pathname); | 107 | DEBUGF("Couldn't find %s in %s\n",name,pathname); |
105 | errno = ENOENT; | 108 | errno = ENOENT; |
109 | openfiles[fd].busy = false; | ||
106 | return -1; | 110 | return -1; |
107 | } | 111 | } |
108 | 112 | ||
109 | openfiles[fd].cacheoffset = -1; | 113 | openfiles[fd].cacheoffset = -1; |
110 | openfiles[fd].fileoffset = 0; | 114 | openfiles[fd].fileoffset = 0; |
111 | openfiles[fd].busy = true; | ||
112 | return fd; | 115 | return fd; |
113 | } | 116 | } |
114 | 117 | ||