summaryrefslogtreecommitdiff
path: root/apps/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugin.c')
-rw-r--r--apps/plugin.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index edf32d227d..46bc0df44d 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -29,6 +29,7 @@
29#include "file.h" 29#include "file.h"
30#include "kernel.h" 30#include "kernel.h"
31#include "sprintf.h" 31#include "sprintf.h"
32#include "logf.h"
32#include "screens.h" 33#include "screens.h"
33#include "misc.h" 34#include "misc.h"
34#include "mas.h" 35#include "mas.h"
@@ -374,15 +375,18 @@ int codec_load_file(const char *plugin, void *parameter)
374 fd = open(plugin, O_RDONLY); 375 fd = open(plugin, O_RDONLY);
375 if (fd < 0) { 376 if (fd < 0) {
376 snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin); 377 snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin);
378 logf("Codec load error:%d", fd);
377 splash(HZ*2, true, msgbuf); 379 splash(HZ*2, true, msgbuf);
378 return fd; 380 return fd;
379 } 381 }
380 382
381 rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE); 383 rc = read(fd, &pluginbuf[0], PLUGIN_BUFFER_SIZE);
382 if (rc <= 0) 384 close(fd);
385 if (rc <= 0) {
386 logf("Codec read error");
383 return PLUGIN_ERROR; 387 return PLUGIN_ERROR;
388 }
384 plugin_size = rc; 389 plugin_size = rc;
385 close(fd);
386 390
387 return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0); 391 return codec_load_ram(pluginbuf, plugin_size, parameter, NULL, 0);
388} 392}