summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-11-01 11:05:30 -0700
committerGlenn Morris <rgm@gnu.org>2014-11-01 11:05:30 -0700
commitd5d8ca30e5f481a32414c42bcc3b5a042061ff07 (patch)
treefebc223f19801e8e01b9498c5ba9d6c7bfcfa091 /src/emacs.c
parente54c5e4e25098be9df9d9c46d32165887b0ff9d3 (diff)
parentb99e8f833671a2b52be654eb477830294c624a97 (diff)
downloademacs-d5d8ca30e5f481a32414c42bcc3b5a042061ff07.tar.gz
Merge from emacs-24; up to 117656
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 90182e53e70..62f03c6ea12 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -721,7 +721,7 @@ main (int argc, char **argv)
#ifdef DAEMON_MUST_EXEC
char dname_arg2[80];
#endif
- char *ch_to_dir;
+ char *ch_to_dir = 0;
/* If we use --chdir, this records the original directory. */
char *original_pwd = 0;
@@ -1230,19 +1230,19 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* Started from GUI? */
/* FIXME: Do the right thing if getenv returns NULL, or if
chdir fails. */
- if (! inhibit_window_system && ! isatty (0))
+ if (! inhibit_window_system && ! isatty (0) && ! ch_to_dir)
chdir (getenv ("HOME"));
if (skip_args < argc)
{
if (!strncmp (argv[skip_args], "-psn", 4))
{
skip_args += 1;
- chdir (getenv ("HOME"));
+ if (! ch_to_dir) chdir (getenv ("HOME"));
}
else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4))
{
skip_args += 2;
- chdir (getenv ("HOME"));
+ if (! ch_to_dir) chdir (getenv ("HOME"));
}
}
#endif /* COCOA */