1
0
Fork 0
forked from len0rd/rockbox

Correct checking return value of open in plugins.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23874 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2009-12-06 13:52:28 +00:00
parent e760a5abbf
commit 5cdd920d12
11 changed files with 20 additions and 14 deletions

View file

@ -121,7 +121,7 @@ static bool search_init(const char* file){
clear_display();
rb->splash(0, "Searching...");
fd = rb->open(file, O_RDONLY);
if (fd==-1)
if (fd < 0)
return false;
fdw = rb->creat(resultfile);
@ -132,6 +132,7 @@ static bool search_init(const char* file){
#else
rb->splash(HZ, "File creation failed");
#endif
rb->close(fd);
return false;
}
@ -153,8 +154,9 @@ enum plugin_status plugin_start(const void* parameter)
DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]);
/* Check the extension. We only allow .m3u files. */
if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u") &&
rb->strcasecmp(&filename[rb->strlen(filename)-5], ".m3u8")) {
if (!(p = rb->strrchr(filename, '.')) ||
(rb->strcasecmp(p, ".m3u") && rb->strcasecmp(p, ".m3u8")))
{
rb->splash(HZ, "Not a .m3u or .m3u8 file");
return PLUGIN_ERROR;
}