summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@open.eurogiciel.org>2014-05-16 10:36:44 +0200
committerManuel Bachmann <manuel.bachmann@open.eurogiciel.org>2014-05-16 11:42:01 +0200
commit7043d02468575d51363b3aa6d80ee06444af1d6e (patch)
tree805d6406c71e67d78e23156125ad87ff9bf66783
parenteb16165b7bcdb503a9e17e4ea9377d7e6359f5f0 (diff)
downloadweston-common-7043d02468575d51363b3aa6d80ee06444af1d6e.tar.gz
weston-common-7043d02468575d51363b3aa6d80ee06444af1d6e.tar.bz2
weston-common-7043d02468575d51363b3aa6d80ee06444af1d6e.zip
Check if the command array is valid, and exit cleanly of the child if execution fails for some reason. Change-Id: I7017a6f24e628d2d1995b78af5ae26e119acc875 Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
-rw-r--r--tz-launcher/tz-launcher-wl.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/tz-launcher/tz-launcher-wl.c b/tz-launcher/tz-launcher-wl.c
index b580367..c990423 100644
--- a/tz-launcher/tz-launcher-wl.c
+++ b/tz-launcher/tz-launcher-wl.c
@@ -192,11 +192,14 @@ launcher_button_handler(struct widget *widget,
widget_schedule_redraw (widget);
if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
- if (fork () == 0) {
- gchar **command = g_strsplit (launcher->exec, " ", 0);
- execvp (command[0], command);
- g_strfreev (command);
+ gchar **command = g_strsplit (launcher->exec, " ", 0);
+ if (command && command[0]) {
+ if (vfork () == 0) {
+ if (execvp (command[0], command) < 0)
+ _exit (1);
}
+ }
+ g_strfreev (command);
}
}
@@ -210,11 +213,14 @@ launcher_touch_up_handler(struct widget *widget, struct input *input,
launcher->focused = 0;
widget_schedule_redraw(widget);
- if (fork () == 0) {
- gchar **command = g_strsplit (launcher->exec, " ", 0);
- execvp (command[0], command);
- g_strfreev (command);
+ gchar **command = g_strsplit (launcher->exec, " ", 0);
+ if (command && command[0]) {
+ if (vfork () == 0) {
+ if (execvp (command[0], command) < 0)
+ _exit (1);
+ }
}
+ g_strfreev (command);
}
static void