• Paul Eggert's avatar
    Port redirect-debugging-output to non-GNU/Linux · 6bccb19c
    Paul Eggert authored
    Problem reported by Kylie McClain for musl in:
    http://lists.gnu.org/archive/html/emacs-devel/2016-03/msg01592.html
    * etc/DEBUG, etc/NEWS: Mention this.
    * src/callproc.c (child_setup) [!MSDOS]:
    * src/dispnew.c (init_display):
    * src/emacs.c (main, Fdaemon_initialized):
    * src/minibuf.c (read_minibuf_noninteractive):
    * src/regex.c (xmalloc, xrealloc):
    Prefer symbolic names like STDERR_FILENO to magic numbers like 2,
    to make file-descriptor manipulation easier to follow.
    * src/emacs.c (relocate_fd) [!WINDOWSNT]: Remove; no longer needed
    now that we make sure stdin, stdout and stderr are open.  All uses
    removed.
    (main): Make sure standard FDs are OK.  Prefer symbolic names like
    EXIT_FAILURE to magic numbers like 1.  Use bool for boolean.
    * src/lisp.h (init_standard_fds): New decl.
    * src/print.c (WITH_REDIRECT_DEBUGGING_OUTPUT) [GNU_LINUX]:
    Remove; no longer needed.
    (Fredirect_debugging_output): Define on all platforms, not just
    GNU/Linux.  Redirect file descriptor, not stream, so that the code
    works even if stderr is not an lvalue.  Report an error if the
    file arg is neither a string nor nil.
    (syms_of_print): Always define redirect-debugging-output.
    * src/sysdep.c (force_open, init_standard_fds): New functions.
    6bccb19c
emacs.c 75 KB