Commit ecdcbb9c authored by Christian Persch's avatar Christian Persch

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
parent 95990068
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment