Commit 32299e33 authored by Paul Eggert's avatar Paul Eggert

don't ignore chdir failure

* sysdep.c (sys_subshell) [!defined DOS_NT]: Diagnose chdir
failure and exit.
(sys_subshell) [defined DOS_NT]: Mark with a FIXME the two
remaining unchecked chdir calls in this function; some DOS/NT
expert needs to fix them.
* emacs.c (main): Mark with a FIXME the unchecked chdir calls
in this function; some NextStep expert needs to fix them.
parent 7fbf7cae
2011-02-05 Paul Eggert <eggert@cs.ucla.edu>
don't ignore chdir failure
* sysdep.c (sys_subshell) [!defined DOS_NT]: Diagnose chdir
failure and exit.
(sys_subshell) [defined DOS_NT]: Mark with a FIXME the two
remaining unchecked chdir calls in this function; some DOS/NT
expert needs to fix them.
* emacs.c (main): Mark with a FIXME the unchecked chdir calls
in this function; some NextStep expert needs to fix them.
2011-02-05 Glenn Morris <rgm@gnu.org>
* xfaces.c (Finternal_set_lisp_face_attribute):
......@@ -1296,6 +1296,8 @@ main (int argc, char **argv)
#ifdef NS_IMPL_COCOA
if (skip_args < argc)
{
/* FIXME: Do the right thing if getenv returns NULL, or if
chdir fails. */
if (!strncmp(argv[skip_args], "-psn", 4))
{
skip_args += 1;
......
......@@ -548,8 +548,13 @@ sys_subshell (void)
sh = "sh";
/* Use our buffer's default directory for the subshell. */
if (str)
chdir ((char *) str);
if (str && chdir ((char *) str) != 0)
{
#ifndef DOS_NT
ignore_value (write (1, "Can't chdir\n", 12));
_exit (1);
#endif
}
close_process_descs (); /* Close Emacs's pipes/ptys */
......@@ -567,7 +572,7 @@ sys_subshell (void)
setenv ("PWD", str, 1);
}
st = system (sh);
chdir (oldwd);
chdir (oldwd); /* FIXME: Do the right thing on chdir failure. */
if (epwd)
putenv (old_pwd); /* restore previous value */
}
......@@ -575,7 +580,7 @@ sys_subshell (void)
#ifdef WINDOWSNT
/* Waits for process completion */
pid = _spawnlp (_P_WAIT, sh, sh, NULL);
chdir (oldwd);
chdir (oldwd); /* FIXME: Do the right thing on chdir failure. */
if (pid == -1)
write (1, "Can't execute subshell", 22);
#else /* not WINDOWSNT */
......
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