From af11439bd5b95d287e5b86c87ceb23adf1374d48 Mon Sep 17 00:00:00 2001 From: kohlerm Date: Fri, 31 Mar 2017 13:47:07 +0000 Subject: [PATCH 1/2] improving shell detection --- termite.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/termite.cc b/termite.cc index c8ca152..c12ac10 100644 --- a/termite.cc +++ b/termite.cc @@ -1480,11 +1480,17 @@ static void exit_with_success(VteTerminal *) { } static char *get_user_shell_with_fallback() { - if (const char *env = g_getenv("SHELL")) - return g_strdup(env); + if (const char *env = g_getenv("SHELL") ) + { + if (!((env != NULL) && (env[0] == '\0'))) + return g_strdup(env); + } if (char *command = vte_get_user_shell()) - return command; + { + if (!((command != NULL) && (command[0] == '\0'))) + return command; + } return g_strdup("/bin/sh"); } From 340a1613bb57acf1c69f4d12b081729e39edc587 Mon Sep 17 00:00:00 2001 From: Markus Kohler Date: Fri, 31 Mar 2017 18:03:31 +0200 Subject: [PATCH 2/2] reformatted --- termite.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/termite.cc b/termite.cc index c12ac10..641c68d 100644 --- a/termite.cc +++ b/termite.cc @@ -1480,14 +1480,12 @@ static void exit_with_success(VteTerminal *) { } static char *get_user_shell_with_fallback() { - if (const char *env = g_getenv("SHELL") ) - { + if (const char *env = g_getenv("SHELL") ) { if (!((env != NULL) && (env[0] == '\0'))) return g_strdup(env); } - if (char *command = vte_get_user_shell()) - { + if (char *command = vte_get_user_shell()) { if (!((command != NULL) && (command[0] == '\0'))) return command; }