summaryrefslogtreecommitdiffstats
path: root/apps/cuesheet.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-04-16 19:51:43 +0000
committerNils Wallménius <nils@rockbox.org>2008-04-16 19:51:43 +0000
commita01996436d09eca8ae114e67005d2cac73cae7b3 (patch)
tree013d6787d3c03265049536677e817572c4285119 /apps/cuesheet.c
parentd65930f9720b0d51313b0e76251e56d2ffa144dd (diff)
downloadrockbox-a01996436d09eca8ae114e67005d2cac73cae7b3.tar.gz
rockbox-a01996436d09eca8ae114e67005d2cac73cae7b3.tar.bz2
rockbox-a01996436d09eca8ae114e67005d2cac73cae7b3.zip
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
Diffstat (limited to 'apps/cuesheet.c')
-rw-r--r--apps/cuesheet.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index ba6bc9659d..dcdba9f4c6 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -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;