Janne Blomqvist wrote: > libgfortran was happily assuming that STD{IN,OUT,ERR}_FILENO were open > and no error checking was performed on the fstat() call
> Tested on x86_64-unknown-linux-gnu, Ok for trunk/4.9/4.8/4.7? Looks good to me. Thanks! Note that 4.8 has been frozen, cf. https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01168.html But it might be hold off: https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01181.html Thus, please check with the release managers/Richard whether you may commit the patch, e.g. by pinging Richard on #gcc's IRC channel. Tobias > 2014-05-15 Janne Blomqvist <j...@gcc.gnu.org> > > PR libfortran/61187 > * io/unix.c (raw_close): Check if s->fd is -1. > (fd_to_stream): Check return value of fstat(), handle error.