a_main_startup(): isatty() yay fdopen(,"w") nay (A. B., E. E., G. B.)..
commitb039b3096a09b1a74a495fdfd251a7be3dbe261f
authorSteffen Nurpmeso <steffen@sdaoden.eu>
Fri, 27 Oct 2017 20:07:29 +0000 (27 22:07 +0200)
committerSteffen Nurpmeso <steffen@sdaoden.eu>
Fri, 27 Oct 2017 20:38:12 +0000 (27 22:38 +0200)
treead65fbfd1b56f464124fcb0587a408131afef97f
parent3dc1d4ee624204aa6e7903f31e7cd5971238d4a2
a_main_startup(): isatty() yay fdopen(,"w") nay (A. B., E. E., G. B.)..

The ArchLinux test framework trapped us again.  This time Andreas
Baumann (mail AT andreasbaumann DOT cc) discovered, and he and
Erich Eckner (erich DOT eckner AT gmx DOT de) isolated
a segmentation violation[1] in an environment which indeed managed
to create the situation where

  isatty(STDIN_FILENO)

is true but

  fdopen(fileno(n_stdin), "w")

is not.

This lead to a bug report[2].  It turned out that the
ArchLinux test environment now redirects /dev/console to
STDIN_FILENO[3] to gain.  Gaetan Bisson temporarily fixed the
issue by running "make test < /dev/null" and reported the issue.

  [1] https://bbs.archlinux32.org/viewtopic.php?pid=486#p486
  [2] https://bugs.archlinux.org/task/56124
  [3] https://git.archlinux.org/devtools.git/commit/?id=ddd508efc083fc9beb6f2c96e2537521b31c1e6f

We were not prepared for that, so check the n_tty_fp that results
from the fdopen(3) against NULL before calling setvbuf(3) on it.
All this must vanish in v15.
main.c