[Xfce4-commits] r29638 - in terminal/trunk: . terminal
Jannis Pohlmann
jannis at xfce.org
Sun Mar 1 20:31:24 CET 2009
Author: jannis
Date: 2009-03-01 19:31:23 +0000 (Sun, 01 Mar 2009)
New Revision: 29638
Modified:
terminal/trunk/ChangeLog
terminal/trunk/terminal/terminal-screen.c
Log:
* terminal/terminal-screen.c: Fall back to the SHELL environment
variable or to /bin/sh if there's no login shell defined for the
current user. This fixes bug #4970. Patch cooked up by Robby Workman
and Enrico Tr?\195?\182ger.
Modified: terminal/trunk/ChangeLog
===================================================================
--- terminal/trunk/ChangeLog 2009-02-28 12:14:57 UTC (rev 29637)
+++ terminal/trunk/ChangeLog 2009-03-01 19:31:23 UTC (rev 29638)
@@ -1,3 +1,10 @@
+2009-03-01 Jannis Pohlmann <jannis at xfce.org>
+
+ * terminal/terminal-screen.c: Fall back to the SHELL environment
+ variable or to /bin/sh if there's no login shell defined for the
+ current user. This fixes bug #4970. Patch cooked up by Robby Workman
+ and Enrico Tröger.
+
2009-02-26 Jannis Pohlmann <jannis at xfce.org>
* == Released 0.2.10 ==
Modified: terminal/trunk/terminal/terminal-screen.c
===================================================================
--- terminal/trunk/terminal/terminal-screen.c 2009-02-28 12:14:57 UTC (rev 29637)
+++ terminal/trunk/terminal/terminal-screen.c 2009-03-01 19:31:23 UTC (rev 29638)
@@ -447,7 +447,8 @@
GError **error)
{
struct passwd *pw;
- const gchar *shell_name;
+ const gchar *shell_name = NULL;
+ const gchar *shell_fullpath;
gboolean command_login_shell;
if (screen->custom_command != NULL)
@@ -469,12 +470,25 @@
"command-login-shell", &command_login_shell,
NULL);
- shell_name = strrchr (pw->pw_shell, '/');
+
+ if (pw->pw_shell == NULL || *(pw->pw_shell) == 0)
+ {
+ shell_fullpath = g_getenv ("SHELL");
+ if (shell_fullpath == NULL)
+ /* the very last fallback */
+ shell_fullpath = "/bin/sh";
+ }
+ else
+ shell_fullpath = pw->pw_shell;
+
+ if (shell_fullpath != NULL)
+ shell_name = strrchr (shell_fullpath, '/');
+
if (shell_name != NULL)
++shell_name;
else
- shell_name = pw->pw_shell;
- *command = g_strdup (pw->pw_shell);
+ shell_name = shell_fullpath;
+ *command = g_strdup (shell_fullpath);
*argv = g_new (gchar *, 2);
if (command_login_shell)
More information about the Xfce4-commits
mailing list