diff options
Diffstat (limited to 'apps/plugins/open_plugins.c')
-rw-r--r-- | apps/plugins/open_plugins.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index a4b19d558f..b608aff789 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c | |||
@@ -101,7 +101,7 @@ static bool op_entry_read(int fd, int selected_item, off_t data_sz) | |||
101 | { | 101 | { |
102 | rb->memset(&op_entry, 0, op_entry_sz); | 102 | rb->memset(&op_entry, 0, op_entry_sz); |
103 | op_entry.lang_id = -1; | 103 | op_entry.lang_id = -1; |
104 | return ((selected_item >= 0) && | 104 | return ((selected_item >= 0) && (fd >= 0) && |
105 | (rb->lseek(fd, selected_item * op_entry_sz, SEEK_SET) >= 0) && | 105 | (rb->lseek(fd, selected_item * op_entry_sz, SEEK_SET) >= 0) && |
106 | (rb->read(fd, &op_entry, data_sz) == data_sz) && op_entry_checksum() > 0); | 106 | (rb->read(fd, &op_entry, data_sz) == data_sz) && op_entry_checksum() > 0); |
107 | } | 107 | } |
@@ -196,7 +196,7 @@ static int op_entry_set_path(void) | |||
196 | 196 | ||
197 | struct browse_context browse = { | 197 | struct browse_context browse = { |
198 | .dirfilter = SHOW_ALL, | 198 | .dirfilter = SHOW_ALL, |
199 | .flags = BROWSE_SELECTONLY, | 199 | .flags = BROWSE_SELECTONLY | BROWSE_DIRFILTER, |
200 | .title = rb->str(LANG_ADD), | 200 | .title = rb->str(LANG_ADD), |
201 | .icon = Icon_Plugin, | 201 | .icon = Icon_Plugin, |
202 | .root = op_entry.path, | 202 | .root = op_entry.path, |
@@ -225,7 +225,7 @@ static int op_entry_set_param_path(void) | |||
225 | 225 | ||
226 | struct browse_context browse = { | 226 | struct browse_context browse = { |
227 | .dirfilter = SHOW_ALL, | 227 | .dirfilter = SHOW_ALL, |
228 | .flags = BROWSE_SELECTONLY, | 228 | .flags = BROWSE_SELECTONLY | BROWSE_DIRFILTER, |
229 | .title = rb->str(LANG_PARAMETER), | 229 | .title = rb->str(LANG_PARAMETER), |
230 | .icon = Icon_Plugin, | 230 | .icon = Icon_Plugin, |
231 | .root = tmp_buf, | 231 | .root = tmp_buf, |
@@ -412,6 +412,7 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha | |||
412 | { | 412 | { |
413 | rb->close(fd_tmp); | 413 | rb->close(fd_tmp); |
414 | rb->close(fd_dat); | 414 | rb->close(fd_dat); |
415 | fd_dat = -1; | ||
415 | rb->remove(OPEN_PLUGIN_DAT); | 416 | rb->remove(OPEN_PLUGIN_DAT); |
416 | rb->rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT); | 417 | rb->rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT); |
417 | } | 418 | } |
@@ -468,7 +469,7 @@ static void op_entry_remove(int selection) | |||
468 | static void op_entry_remove_empty(void) | 469 | static void op_entry_remove_empty(void) |
469 | { | 470 | { |
470 | bool resave = false; | 471 | bool resave = false; |
471 | if (fd_dat && rb->lseek(fd_dat, 0, SEEK_SET) == 0) | 472 | if (fd_dat >= 0 && rb->lseek(fd_dat, 0, SEEK_SET) == 0) |
472 | { | 473 | { |
473 | while (resave == false && | 474 | while (resave == false && |
474 | rb->read(fd_dat, &op_entry, op_entry_sz) == op_entry_sz) | 475 | rb->read(fd_dat, &op_entry, op_entry_sz) == op_entry_sz) |
@@ -489,6 +490,7 @@ static void op_entry_remove_empty(void) | |||
489 | { | 490 | { |
490 | rb->close(fd_tmp); | 491 | rb->close(fd_tmp); |
491 | rb->close(fd_dat); | 492 | rb->close(fd_dat); |
493 | fd_dat = -1; | ||
492 | rb->remove(OPEN_PLUGIN_DAT); | 494 | rb->remove(OPEN_PLUGIN_DAT); |
493 | rb->rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT); | 495 | rb->rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT); |
494 | } | 496 | } |