emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103137: Merge: don't ignore chdir fa


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103137: Merge: don't ignore chdir failure
Date: Sat, 05 Feb 2011 17:26:38 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103137 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2011-02-05 17:26:38 -0800
message:
  Merge: don't ignore chdir failure
modified:
  src/ChangeLog
  src/emacs.c
  src/sysdep.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-02-05 22:30:14 +0000
+++ b/src/ChangeLog     2011-02-06 01:25:41 +0000
@@ -1,3 +1,14 @@
+2011-02-05  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * xfaces.c (Finternal_set_lisp_face_attribute):

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2011-01-31 08:12:52 +0000
+++ b/src/emacs.c       2011-02-06 01:25:41 +0000
@@ -1296,6 +1296,8 @@
 #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;

=== modified file 'src/sysdep.c'
--- a/src/sysdep.c      2011-02-03 19:29:35 +0000
+++ b/src/sysdep.c      2011-02-06 01:25:41 +0000
@@ -548,8 +548,13 @@
        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 @@
            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 @@
 #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 */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]