summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-11-01 19:11:37 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2013-11-01 19:11:37 -0700
commita90e5a330c68cd42347083c21a6d495bbff7b547 (patch)
tree8735672b53214744c0f627072d425677f721058a /src/emacs.c
parent7ffd37219b311035fd346a126d7799cb53c6c73d (diff)
downloademacs-a90e5a330c68cd42347083c21a6d495bbff7b547.tar.gz
* emacs.c (original_pwd): Remove global var by making it local.
(init_cmdargs): New arg ORIGINAL_PWD; caller changed.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 92b52f1cea6..ed93067d1fd 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -202,9 +202,6 @@ static char *daemon_name;
startup. */
int daemon_pipe[2];
-/* If we use --chdir, this records the original directory. */
-char *original_pwd;
-
/* Save argv and argc. */
char **initial_argv;
int initial_argc;
@@ -386,7 +383,7 @@ terminate_due_to_signal (int sig, int backtrace_limit)
/* Code for dealing with Lisp access to the Unix command line. */
static void
-init_cmdargs (int argc, char **argv, int skip_args)
+init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
{
register int i;
Lisp_Object name, dir, handler;
@@ -705,6 +702,9 @@ main (int argc, char **argv)
#endif
char *ch_to_dir;
+ /* If we use --chdir, this records the original directory. */
+ char *original_pwd = 0;
+
#if GC_MARK_STACK
stack_base = &dummy;
#endif
@@ -794,7 +794,7 @@ main (int argc, char **argv)
if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args))
{
original_pwd = get_current_dir_name ();
- if (chdir (ch_to_dir) == -1)
+ if (chdir (ch_to_dir) != 0)
{
fprintf (stderr, "%s: Can't chdir to %s: %s\n",
argv[0], ch_to_dir, strerror (errno));
@@ -1330,7 +1330,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
init_buffer (); /* Init default directory of main buffer. */
init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */
- init_cmdargs (argc, argv, skip_args); /* Must precede init_lread. */
+
+ /* Must precede init_lread. */
+ init_cmdargs (argc, argv, skip_args, original_pwd);
if (initialized)
{