+2013-11-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ * emacs.c (original_pwd): Remove global var by making it local.
+ (init_cmdargs): New arg ORIGINAL_PWD; caller changed.
+
2013-11-01 Jan Djärv <jan.h.d@swipnet.se>
* xfaces.c: Declare color_distance.
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;
/* 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;
#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
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));
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)
{