emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113394: Minor EBADF fixes.


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113394: Minor EBADF fixes.
Date: Fri, 12 Jul 2013 14:31:46 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113394
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2013-07-12 07:31:42 -0700
message:
  Minor EBADF fixes.
  
  * process.c (create_process, wait_reading_process_output) [AIX]:
  Remove obsolete SIGHUP-related  code, as Emacs no longer disables
  SIGHUP, so EBADF is no longer acceptable here (it wouldn't work in
  a multithreaded environment anyway).
  * sysdep.c (emacs_close): It's not dangerous to invoke emacs_close (-1).
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
  src/process.c                  process.c-20091113204419-o5vbwnq5f7feedwu-462
  src/sysdep.c                   sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-07-12 09:02:30 +0000
+++ b/src/ChangeLog     2013-07-12 14:31:42 +0000
@@ -1,3 +1,12 @@
+2013-07-12  Paul Eggert  <address@hidden>
+
+       Minor EBADF fixes.
+       * process.c (create_process, wait_reading_process_output) [AIX]:
+       Remove obsolete SIGHUP-related  code, as Emacs no longer disables
+       SIGHUP, so EBADF is no longer acceptable here (it wouldn't work in
+       a multithreaded environment anyway).
+       * sysdep.c (emacs_close): It's not dangerous to invoke emacs_close (-1).
+
 2013-07-12  Andreas Schwab  <address@hidden>
 
        * image.c (x_find_image_file): Don't close a remote file handle.

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2013-07-06 02:40:50 +0000
+++ b/src/keyboard.c    2013-07-12 14:31:42 +0000
@@ -7008,7 +7008,7 @@
     {
       nread = emacs_read (fileno (tty->input), (char *) cbuf, n_to_read);
       /* POSIX infers that processes which are not in the session leader's
-         process group won't get SIGHUP's at logout time.  BSDI adheres to
+         process group won't get SIGHUPs at logout time.  BSDI adheres to
          this part standard and returns -1 from read (0) with errno==EIO
          when the control tty is taken away.
          Jeffrey Honig <address@hidden> says this is generally safe.  */

=== modified file 'src/process.c'
--- a/src/process.c     2013-07-12 02:03:47 +0000
+++ b/src/process.c     2013-07-12 14:31:42 +0000
@@ -1812,12 +1812,6 @@
          SETUP_SLAVE_PTY;
        }
 #endif /* SETUP_SLAVE_PTY */
-#ifdef AIX
-      /* On AIX, we've disabled SIGHUP above once we start a child on a pty.
-        Now reenable it in the child, so it will die when we want it to.  */
-      if (pty_flag)
-       signal (SIGHUP, SIG_DFL);
-#endif
 #endif /* HAVE_PTYS */
 
       signal (SIGINT, SIG_DFL);
@@ -4632,20 +4626,7 @@
          if (xerrno == EINTR)
            no_avail = 1;
          else if (xerrno == EBADF)
-           {
-#ifdef AIX
-             /* AIX doesn't handle PTY closure the same way BSD does.  On AIX,
-                the child's closure of the pts gives the parent a SIGHUP, and
-                the ptc file descriptor is automatically closed,
-                yielding EBADF here or at select() call above.
-                So, SIGHUP is ignored (see def of PTY_TTY_NAME_SPRINTF
-                in m/ibmrt-aix.h), and here we just ignore the select error.
-                Cleanup occurs c/o status_notify after SIGCHLD. */
-             no_avail = 1; /* Cannot depend on values returned */
-#else
-             emacs_abort ();
-#endif
-           }
+           emacs_abort ();
          else
            error ("select error: %s", emacs_strerror (xerrno));
        }

=== modified file 'src/sysdep.c'
--- a/src/sysdep.c      2013-07-12 02:03:47 +0000
+++ b/src/sysdep.c      2013-07-12 14:31:42 +0000
@@ -2237,8 +2237,8 @@
    arriving.  FD is always closed when this function returns, even
    when it returns -1.
 
-   Do not call this function if FD might already be closed, as that
-   might close an innocent victim opened by some other thread.  */
+   Do not call this function if FD is nonnegative and might already be closed,
+   as that might close an innocent victim opened by some other thread.  */
 
 int
 emacs_close (int fd)
@@ -2250,7 +2250,7 @@
        return r;
       if (!POSIX_CLOSE_RESTART || errno != EINTR)
        {
-         eassert (errno != EBADF);
+         eassert (errno != EBADF || fd < 0);
          return errno == EINPROGRESS ? 0 : r;
        }
     }


reply via email to

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