gnome-terminal r3372 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r3372 - trunk/src
- Date: Thu, 19 Mar 2009 13:48:16 +0000 (UTC)
Author: chpe
Date: Thu Mar 19 13:48:16 2009
New Revision: 3372
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=3372&view=rev
Log:
Use the passed remote env to lookup SHELL and http_proxy, not the
factory's env.
Modified:
trunk/src/eggshell.c
trunk/src/eggshell.h
trunk/src/terminal-screen.c
Modified: trunk/src/eggshell.c
==============================================================================
--- trunk/src/eggshell.c (original)
+++ trunk/src/eggshell.c Thu Mar 19 13:48:16 2009
@@ -48,18 +48,18 @@
/**
* egg_shell:
+ * @shell: the value of the SHELL env variable
*
* Retrieves the user's preferred shell.
*
* Returns: A newly allocated string that is the path to the shell.
*/
char *
-egg_shell (void)
+egg_shell (const char *shell)
{
#ifndef G_OS_WIN32
struct passwd *pw;
int i;
- const char *shell;
const char shells [][14] = {
/* Note that on some systems shells can also
* be installed in /usr/bin */
@@ -73,7 +73,7 @@
if (geteuid () == getuid () &&
getegid () == getgid ()) {
/* only in non-setuid */
- if ((shell = g_getenv ("SHELL"))){
+ if (shell != NULL) {
if (access (shell, X_OK) == 0) {
return g_strdup (shell);
}
Modified: trunk/src/eggshell.h
==============================================================================
--- trunk/src/eggshell.h (original)
+++ trunk/src/eggshell.h Thu Mar 19 13:48:16 2009
@@ -33,7 +33,7 @@
G_BEGIN_DECLS
/* Find the name of the user's shell. */
-char *egg_shell (void);
+char *egg_shell (const char *shell);
G_END_DECLS
Modified: trunk/src/terminal-screen.c
==============================================================================
--- trunk/src/terminal-screen.c (original)
+++ trunk/src/terminal-screen.c Thu Mar 19 13:48:16 2009
@@ -1224,6 +1224,7 @@
static gboolean
get_child_command (TerminalScreen *screen,
+ const char *shell_env,
char **file_p,
char ***argv_p,
GError **err)
@@ -1262,7 +1263,7 @@
const char *only_name;
char *shell;
- shell = egg_shell ();
+ shell = egg_shell (shell_env);
file = g_strdup (shell);
@@ -1298,7 +1299,8 @@
}
static char**
-get_child_environment (TerminalScreen *screen)
+get_child_environment (TerminalScreen *screen,
+ char **shell)
{
TerminalScreenPrivate *priv = screen->priv;
GtkWidget *term = GTK_WIDGET (screen);
@@ -1359,7 +1361,7 @@
g_free (proxymode);
/* Do we already have a proxy setting? */
- if (getenv ("http_proxy"))
+ if (g_hash_table_lookup (env_table, "http_proxy") != NULL)
use_proxy = FALSE;
/* Do we have no proxy host or an empty string? */
@@ -1469,6 +1471,8 @@
g_ptr_array_add (retval, g_strdup_printf ("%s=%s", e, v ? v : ""));
g_ptr_array_add (retval, NULL);
+ *shell = g_strdup (g_hash_table_lookup (env_table, "SHELL"));
+
g_hash_table_destroy (env_table);
return (char **) g_ptr_array_free (retval, FALSE);
}
@@ -1480,22 +1484,24 @@
VteTerminal *terminal = VTE_TERMINAL (screen);
TerminalProfile *profile;
char **env, **argv;
- char *path;
- GError *err;
+ char *path, *shell = NULL;
+ GError *err = NULL;
gboolean update_records;
profile = priv->profile;
- err = NULL;
- if (!get_child_command (screen, &path, &argv, &err))
+ env = get_child_environment (screen, &shell);
+
+ if (!get_child_command (screen, shell, &path, &argv, &err))
{
show_command_error_dialog (screen, err);
g_error_free (err);
+
+ g_strfreev (env);
+ g_free (shell);
return;
}
- env = get_child_environment (screen);
-
update_records = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_UPDATE_RECORDS);
priv->child_pid = vte_terminal_fork_command (terminal,
@@ -1516,6 +1522,7 @@
priv->pty_fd = vte_terminal_get_pty (terminal);
+ g_free (shell);
g_free (path);
g_strfreev (argv);
g_strfreev (env);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]