[gnome-terminal] chdir to $HOME in the factory process



commit 1827f28b6db23206c74ea061fce317ad797458cb
Author: Christian Persch <chpe gnome org>
Date:   Tue Jul 21 21:39:36 2009 +0200

    chdir to $HOME in the factory process
    
    Go back to using $HOME instead of /. See bug #565328 and dups.

 src/terminal.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/terminal.c b/src/terminal.c
index 1611a75..aaf072a 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -253,6 +253,7 @@ main (int argc, char **argv)
   DBusGProxy *proxy;
   guint32 request_name_ret;
   GError *error = NULL;
+  const char *home_dir;
 
   setlocale (LC_ALL, "");
 
@@ -480,11 +481,13 @@ factory_disabled:
   terminal_app_handle_options (terminal_app_get (), options, TRUE /* allow resume */, NULL);
   terminal_options_free (options);
 
-  /* Now change directory to / so we don't prevent unmounting, e.g. if the
+  /* Now change directory to $HOME so we don't prevent unmounting, e.g. if the
    * factory is started by nautilus-open-terminal. See bug #565328.
+   * On failure back to /.
    */
-  if (chdir ("/") < 0)
-    g_warning ("Failed to chdir to /: %s", g_strerror (errno));
+  home_dir = g_get_home_dir ();
+  if (home_dir == NULL || chdir (home_dir) < 0)
+    (void) chdir ("/");
 
   gtk_main ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]