diff options
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 | } |