emacs-devel
[Top][All Lists]
Advanced

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

Re: attribute warn_unused_result


From: Paul Eggert
Subject: Re: attribute warn_unused_result
Date: Sat, 05 Feb 2011 17:34:49 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

On 02/05/2011 08:35 AM, Chong Yidong wrote:
> If you fix this, please fix it in the emacs-23 branch (assuming the bug
> exists there), so that it will be included in the 23.3 release.

I could do that, but three things.  First, I've never installed
into the emacs-23 branch and am a bit worried about messing with that
if it is about to be released.  Second, I just now installed a fix for
mainline platforms into the trunk (see below) but don't know how
to fix similar problems on Windows, DOS, or NextStep.

Third, the problem doesn't occur in normal operation on
mainline platforms (on RHEL 5.5 I could reproduce it with temacs,
but not with a normal dumped emacs), so it may not be urgent
to put it into emacs-23.

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.
=== modified file 'src/emacs.c'
--- src/emacs.c 2011-01-31 08:12:52 +0000
+++ src/emacs.c 2011-02-06 01:23:24 +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'
--- src/sysdep.c        2011-02-03 19:29:35 +0000
+++ src/sysdep.c        2011-02-06 01:23:24 +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]