Commit 6e987195 authored by Petri Hintukainen's avatar Petri Hintukainen

_scan_dir(): separate error indication from result

parent eabfca95
...@@ -1086,13 +1086,14 @@ static struct udf_dir *_read_subdir(udfread *udf, struct udf_dir *dir, uint32_t ...@@ -1086,13 +1086,14 @@ static struct udf_dir *_read_subdir(udfread *udf, struct udf_dir *dir, uint32_t
return dir->subdirs[index]; return dir->subdirs[index];
} }
static int _scan_dir(const struct udf_dir *dir, const char *filename) static int _scan_dir(const struct udf_dir *dir, const char *filename, uint32_t *index)
{ {
uint32_t i; uint32_t i;
for (i = 0; i < dir->num_entries; i++) { for (i = 0; i < dir->num_entries; i++) {
if (!strcmp(filename, dir->files[i].filename)) { if (!strcmp(filename, dir->files[i].filename)) {
return i; *index = i;
return 0;
} }
} }
...@@ -1124,9 +1125,8 @@ static int _find_file(udfread *udf, const char *path, ...@@ -1124,9 +1125,8 @@ static int _find_file(udfread *udf, const char *path,
} }
while (token) { while (token) {
uint32_t index;
int index = _scan_dir(current_dir, token); if (_scan_dir(current_dir, token, &index) < 0) {
if (index < 0) {
udf_log("_find_file: entry %s not found\n", token); udf_log("_find_file: entry %s not found\n", token);
goto error; goto error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment