From 9cc29ad36075c4c067c12a542b842238788d6391 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Thu, 16 Apr 2009 22:17:50 +0000 Subject: [PATCH] fix bug when there is no file extension. This was spotted by a segmentation faults on systems where sprintf() don't handle NULL as "%s" (Solaris, BSDs), but it makes no sense to lookup "*(null)" as extension on Linux either. Reported by: mcalamell SVN revision: 40120 --- src/bin/e_fm.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 50720d450..ec4b44348 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -7659,8 +7659,8 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) E_Zone *zone; Eina_List *sel, *l = NULL; int x, y, can_w, can_w2, protect; - char buf[PATH_MAX]; - + char buf[PATH_MAX], *ext; + sd = ic->sd; mn = e_menu_new(); @@ -7878,15 +7878,19 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) } /* see if we have any glob handlers registered for this file */ - snprintf(buf, sizeof(buf), "*%s", strrchr(ic->info.file, '.')); - l = e_fm2_mime_handler_glob_handlers_get(buf); - if (l) + ext = strrchr(ic->info.file, '.'); + if (ext) { - _e_fm2_icon_realpath(ic, buf, sizeof(buf)); - _e_fm2_context_menu_append(obj, buf, l, mn, ic); - eina_list_free(l); + snprintf(buf, sizeof(buf), "*%s", ext); + l = e_fm2_mime_handler_glob_handlers_get(buf); + if (l) + { + _e_fm2_icon_realpath(ic, buf, sizeof(buf)); + _e_fm2_context_menu_append(obj, buf, l, mn, ic); + eina_list_free(l); + } } - + if (sd->icon_menu.end.func) sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info)); }