mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
Use file_exists and dir_exists functions where appropriate, fix one wrong file descriptor check and one possible dir descriptor leak
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17147 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d65930f972
commit
a01996436d
8 changed files with 18 additions and 52 deletions
|
|
@ -91,22 +91,20 @@ bool look_for_cuesheet_file(const char *trackpath, char *found_cue_path)
|
|||
dot = strrchr(cuepath, '.');
|
||||
strcpy(dot, ".cue");
|
||||
|
||||
int fd = open(cuepath,O_RDONLY);
|
||||
if (fd < 0)
|
||||
if (!file_exists(cuepath))
|
||||
{
|
||||
strcpy(cuepath, CUE_DIR);
|
||||
strcat(cuepath, slash);
|
||||
char *dot = strrchr(cuepath, '.');
|
||||
strcpy(dot, ".cue");
|
||||
fd = open(cuepath,O_RDONLY);
|
||||
if (fd < 0)
|
||||
if (!file_exists(cuepath))
|
||||
{
|
||||
if (found_cue_path)
|
||||
found_cue_path = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
|
||||
if (found_cue_path)
|
||||
strncpy(found_cue_path, cuepath, MAX_PATH);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue