diff options
| author | Paul Eggert | 2011-02-05 17:25:41 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-05 17:25:41 -0800 |
| commit | 32299e33800dc6a78754b5ac2dc0e15caea93e48 (patch) | |
| tree | fd0c9830df5c85736a2989464ad7a8d9f811bce1 /src | |
| parent | 7fbf7cae66482c80e93acb9864aad31cf29e5c83 (diff) | |
| download | emacs-32299e33800dc6a78754b5ac2dc0e15caea93e48.tar.gz emacs-32299e33800dc6a78754b5ac2dc0e15caea93e48.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/sysdep.c | 13 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d757a89836d..1210b48d98f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2011-02-05 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | don't ignore chdir failure | ||
| 4 | * sysdep.c (sys_subshell) [!defined DOS_NT]: Diagnose chdir | ||
| 5 | failure and exit. | ||
| 6 | (sys_subshell) [defined DOS_NT]: Mark with a FIXME the two | ||
| 7 | remaining unchecked chdir calls in this function; some DOS/NT | ||
| 8 | expert needs to fix them. | ||
| 9 | * emacs.c (main): Mark with a FIXME the unchecked chdir calls | ||
| 10 | in this function; some NextStep expert needs to fix them. | ||
| 11 | |||
| 1 | 2011-02-05 Glenn Morris <rgm@gnu.org> | 12 | 2011-02-05 Glenn Morris <rgm@gnu.org> |
| 2 | 13 | ||
| 3 | * xfaces.c (Finternal_set_lisp_face_attribute): | 14 | * xfaces.c (Finternal_set_lisp_face_attribute): |
diff --git a/src/emacs.c b/src/emacs.c index 53786b0adae..4455e6b4d9f 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1296,6 +1296,8 @@ main (int argc, char **argv) | |||
| 1296 | #ifdef NS_IMPL_COCOA | 1296 | #ifdef NS_IMPL_COCOA |
| 1297 | if (skip_args < argc) | 1297 | if (skip_args < argc) |
| 1298 | { | 1298 | { |
| 1299 | /* FIXME: Do the right thing if getenv returns NULL, or if | ||
| 1300 | chdir fails. */ | ||
| 1299 | if (!strncmp(argv[skip_args], "-psn", 4)) | 1301 | if (!strncmp(argv[skip_args], "-psn", 4)) |
| 1300 | { | 1302 | { |
| 1301 | skip_args += 1; | 1303 | skip_args += 1; |
diff --git a/src/sysdep.c b/src/sysdep.c index 53b7f39171e..5760d0224eb 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -548,8 +548,13 @@ sys_subshell (void) | |||
| 548 | sh = "sh"; | 548 | sh = "sh"; |
| 549 | 549 | ||
| 550 | /* Use our buffer's default directory for the subshell. */ | 550 | /* Use our buffer's default directory for the subshell. */ |
| 551 | if (str) | 551 | if (str && chdir ((char *) str) != 0) |
| 552 | chdir ((char *) str); | 552 | { |
| 553 | #ifndef DOS_NT | ||
| 554 | ignore_value (write (1, "Can't chdir\n", 12)); | ||
| 555 | _exit (1); | ||
| 556 | #endif | ||
| 557 | } | ||
| 553 | 558 | ||
| 554 | close_process_descs (); /* Close Emacs's pipes/ptys */ | 559 | close_process_descs (); /* Close Emacs's pipes/ptys */ |
| 555 | 560 | ||
| @@ -567,7 +572,7 @@ sys_subshell (void) | |||
| 567 | setenv ("PWD", str, 1); | 572 | setenv ("PWD", str, 1); |
| 568 | } | 573 | } |
| 569 | st = system (sh); | 574 | st = system (sh); |
| 570 | chdir (oldwd); | 575 | chdir (oldwd); /* FIXME: Do the right thing on chdir failure. */ |
| 571 | if (epwd) | 576 | if (epwd) |
| 572 | putenv (old_pwd); /* restore previous value */ | 577 | putenv (old_pwd); /* restore previous value */ |
| 573 | } | 578 | } |
| @@ -575,7 +580,7 @@ sys_subshell (void) | |||
| 575 | #ifdef WINDOWSNT | 580 | #ifdef WINDOWSNT |
| 576 | /* Waits for process completion */ | 581 | /* Waits for process completion */ |
| 577 | pid = _spawnlp (_P_WAIT, sh, sh, NULL); | 582 | pid = _spawnlp (_P_WAIT, sh, sh, NULL); |
| 578 | chdir (oldwd); | 583 | chdir (oldwd); /* FIXME: Do the right thing on chdir failure. */ |
| 579 | if (pid == -1) | 584 | if (pid == -1) |
| 580 | write (1, "Can't execute subshell", 22); | 585 | write (1, "Can't execute subshell", 22); |
| 581 | #else /* not WINDOWSNT */ | 586 | #else /* not WINDOWSNT */ |