+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.
{
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. */
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);
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));
}
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)
return r;
if (!POSIX_CLOSE_RESTART || errno != EINTR)
{
- eassert (errno != EBADF);
+ eassert (errno != EBADF || fd < 0);
return errno == EINPROGRESS ? 0 : r;
}
}