[gnome-terminal] client: Get the current directory via PWD
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] client: Get the current directory via PWD
- Date: Mon, 4 Jun 2012 19:11:44 +0000 (UTC)
commit ecdcbb9c55ba385aee5a01ca3e95c910162e0249
Author: Christian Persch <chpe gnome org>
Date: Mon Jun 4 21:04:45 2012 +0200
client: Get the current directory via PWD
If PWD is set and refers to the current directory, use PWD. This is necessary
so that when opening a new terminal in a directory that is a symlink, the shell
starts in the symlink'd directory and not in the symlink's target.
https://bugzilla.gnome.org/show_bug.cgi?id=502146
src/client.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/client.c b/src/client.c
index 9b1993b..0cca227 100644
--- a/src/client.c
+++ b/src/client.c
@@ -23,7 +23,8 @@
* * Author: David Zeuthen <davidz redhat com>
*/
-#include <config.h>
+#include "config.h"
+#define _GNU_SOURCE
#include <errno.h>
#include <locale.h>
@@ -507,8 +508,17 @@ parse_arguments (int *argcp,
}
g_option_context_free (context);
- if (data->working_directory == NULL)
- data->working_directory = g_get_current_dir ();
+ if (data->working_directory == NULL) {
+ char *cwd;
+
+ /* We use get_current_dir_name() here instead of getcwd / g_get_current_dir()
+ * because we want to use the value from PWD (if it is correct).
+ * See bug 502146.
+ */
+ cwd = get_current_dir_name ();
+ data->working_directory = g_strdup (cwd);
+ free (cwd);
+ }
/* Do this here so that gdk_display is initialized */
if (data->startup_id == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]