diff options
| author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-01-02 14:30:18 +0000 |
|---|---|---|
| committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-01-02 14:30:18 +0000 |
| commit | 9d3c7797bfe46fd7ec5e931bf0a812815244197c (patch) | |
| tree | 8ff500d9ce554416d659ae4dd6129896f0501d47 /navit/plugin.c | |
| parent | 23cf51716fbba35d126d29f7e8aaba20e9f59271 (diff) | |
| download | navit-9d3c7797bfe46fd7ec5e931bf0a812815244197c.tar.gz | |
Fix:Core:Fixed usage of wordexp in case of no match
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1876 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/plugin.c')
| -rw-r--r-- | navit/plugin.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/navit/plugin.c b/navit/plugin.c index bf29184e6..6496f746b 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -240,26 +240,28 @@ plugin_new(struct attr *parent, struct attr **attrs) { count=file_wordexp_get_count(we); array=file_wordexp_get_array(we); dbg(2,"expanded to %d words\n",count); - for (i = 0 ; i < count ; i++) { - name=array[i]; - dbg(2,"name[%d]='%s'\n", i, name); - if (! (pl=g_hash_table_lookup(pls->hash, name))) { - pl=plugin_new_from_path(name); - if (! pl) { - dbg(0,"failed to create plugin '%s'\n", name); - continue; + if (count != 1 || file_exists(array[0])) { + for (i = 0 ; i < count ; i++) { + name=array[i]; + dbg(2,"name[%d]='%s'\n", i, name); + if (! (pl=g_hash_table_lookup(pls->hash, name))) { + pl=plugin_new_from_path(name); + if (! pl) { + dbg(0,"failed to create plugin '%s'\n", name); + continue; + } + g_hash_table_insert(pls->hash, plugin_get_name(pl), pl); + pls->list=g_list_append(pls->list, pl); + } else { + pls->list=g_list_remove(pls->list, pl); + pls->list=g_list_append(pls->list, pl); } - g_hash_table_insert(pls->hash, plugin_get_name(pl), pl); - pls->list=g_list_append(pls->list, pl); - } else { - pls->list=g_list_remove(pls->list, pl); - pls->list=g_list_append(pls->list, pl); + plugin_set_active(pl, active); + plugin_set_lazy(pl, lazy); + plugin_set_ondemand(pl, ondemand); } - plugin_set_active(pl, active); - plugin_set_lazy(pl, lazy); - plugin_set_ondemand(pl, ondemand); + file_wordexp_destroy(we); } - file_wordexp_destroy(we); return pl; #endif } |
