• Paul Eggert's avatar
    Fix races with threads and file descriptors. · bacba3c2
    Paul Eggert authored
    * configure.ac (PTY_TTY_NAME_SPRINTF): Use emacs_close, not close.
    * src/callproc.c (Fcall_process_region):
    * src/dired.c (open_directory):
    * src/emacs.c (main, Fdaemon_initialized):
    * src/image.c (x_find_image_file):
    * src/inotify.c (Finotify_rm_watch):
    * src/lread.c (Flocate_file_internal):
    * src/process.c (Fnetwork_interface_list, Fnetwork_interface_info):
    * src/term.c (term_mouse_moveto, init_tty):
    * src/termcap.c (tgetent):
    * src/unexaix.c, src/unexcoff.c (report_error, report_error_1, adjust_lnnoptrs)
    * src/unexaix.c, src/unexcoff.c, src/unexcw.c, src/unexelf.c (unexec):
    * src/unexhp9k800.c, src/unexmacosx.c (unexec):
    * src/callproc.c (Fcall_process_region):
    Use emacs_close, not close.
    * src/sysdep.c (POSIX_CLOSE_RESTART, posix_close) [!POSIX_CLOSE_RESTART]:
    New macro and function, which emulates the POSIX_CLOSE_RESTART macro
    and posix_close function on current platforms (which all lack them).
    (emacs_close): Use it.  This should fix the races on GNU/Linux and
    on AIX and on future platforms that support POSIX_CLOSE_RESTART,
    and it should avoid closing random victim file descriptors on
    other platforms.
    bacba3c2
lread.c 134 KB