From b209d069639885831ae20d696a37f750cfb7e53f Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Sat, 13 Jan 2018 15:04:30 +0100 Subject: [PATCH] Handle execvp error in open_browser The execvp function usually doesn't return and exits by itself. But, when having an error, it returns. As a faulty browser setting could trigger this, dunst has to handle this, as the forked child wants to access the X11 server too, resulting in XIO errors. Fixes #476 --- src/menu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/menu.c b/src/menu.c index 9699b4b..3c4b890 100644 --- a/src/menu.c +++ b/src/menu.c @@ -119,6 +119,12 @@ void open_browser(const char *in) string_append(settings.browser, url, " "); char **cmd = g_strsplit(browser_cmd, " ", 0); execvp(cmd[0], cmd); + // execvp won't return if it's successful + // so, if we're here, it's definitely an error + fprintf(stderr, "Warning: failed to execute '%s': %s\n", + settings.browser, + strerror(errno)); + exit(EXIT_FAILURE); } } }