]> git.eshelyaron.com Git - emacs.git/commitdiff
Minor EBADF fixes.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 12 Jul 2013 14:31:42 +0000 (07:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 12 Jul 2013 14:31:42 +0000 (07:31 -0700)
* 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).

src/ChangeLog
src/keyboard.c
src/process.c
src/sysdep.c

index 75031274694e6ce4bd213593641d40da81dd0be3..dfc74d7bb3957b2cba5a6465891322ed5108c86c 100644 (file)
@@ -1,3 +1,12 @@
+2013-07-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <schwab@linux-m68k.org>
 
        * image.c (x_find_image_file): Don't close a remote file handle.
index 39535f5cd714b6785f99b6e24ce4de8de68313cc..b6eb9e6ad153372004295853f8bf09bed58fedb5 100644 (file)
@@ -7008,7 +7008,7 @@ tty_read_avail_input (struct terminal *terminal,
     {
       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 <jch@bsdi.com> says this is generally safe.  */
index bdab1f8cb8ab1a029ff14774cc544f84e97bc010..81be29082fcf58778542fc73e5eb1b7a7e5ce1f6 100644 (file)
@@ -1812,12 +1812,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
          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 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
          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));
        }
index a1f217b39a66e8e68ea947608cd62bfe6cc7530b..f614d8bc5573b1592a9e5170f874ac814681b1f3 100644 (file)
@@ -2237,8 +2237,8 @@ posix_close (int fd, int flag)
    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 @@ emacs_close (int fd)
        return r;
       if (!POSIX_CLOSE_RESTART || errno != EINTR)
        {
-         eassert (errno != EBADF);
+         eassert (errno != EBADF || fd < 0);
          return errno == EINPROGRESS ? 0 : r;
        }
     }