diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2009-12-06 13:52:28 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2009-12-06 13:52:28 +0000 |
commit | 5cdd920d1267a7548ab492864c4a20a20c3d93ff (patch) | |
tree | 518ddb3cbbf4eabcb8ca0941e386a285c56b53bb /apps/plugins/search.c | |
parent | e760a5abbf951fd22e1dd8eb116e344ad3d76a61 (diff) | |
download | rockbox-5cdd920d1267a7548ab492864c4a20a20c3d93ff.tar.gz rockbox-5cdd920d1267a7548ab492864c4a20a20c3d93ff.zip |
Correct checking return value of open in plugins.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23874 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/search.c')
-rw-r--r-- | apps/plugins/search.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index e9732d219b..d732c0282b 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -121,7 +121,7 @@ static bool search_init(const char* file){ | |||
121 | clear_display(); | 121 | clear_display(); |
122 | rb->splash(0, "Searching..."); | 122 | rb->splash(0, "Searching..."); |
123 | fd = rb->open(file, O_RDONLY); | 123 | fd = rb->open(file, O_RDONLY); |
124 | if (fd==-1) | 124 | if (fd < 0) |
125 | return false; | 125 | return false; |
126 | 126 | ||
127 | fdw = rb->creat(resultfile); | 127 | fdw = rb->creat(resultfile); |
@@ -132,6 +132,7 @@ static bool search_init(const char* file){ | |||
132 | #else | 132 | #else |
133 | rb->splash(HZ, "File creation failed"); | 133 | rb->splash(HZ, "File creation failed"); |
134 | #endif | 134 | #endif |
135 | rb->close(fd); | ||
135 | return false; | 136 | return false; |
136 | } | 137 | } |
137 | 138 | ||
@@ -153,8 +154,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
153 | 154 | ||
154 | DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]); | 155 | DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]); |
155 | /* Check the extension. We only allow .m3u files. */ | 156 | /* Check the extension. We only allow .m3u files. */ |
156 | if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u") && | 157 | if (!(p = rb->strrchr(filename, '.')) || |
157 | rb->strcasecmp(&filename[rb->strlen(filename)-5], ".m3u8")) { | 158 | (rb->strcasecmp(p, ".m3u") && rb->strcasecmp(p, ".m3u8"))) |
159 | { | ||
158 | rb->splash(HZ, "Not a .m3u or .m3u8 file"); | 160 | rb->splash(HZ, "Not a .m3u or .m3u8 file"); |
159 | return PLUGIN_ERROR; | 161 | return PLUGIN_ERROR; |
160 | } | 162 | } |