On Wed, 29 Jul 2015 17:41:19 -0400, "Ted Unangst" wrote: > when does fileno(stdin) return -1?
It looks like _file in struct __sFILE (aka FILE) is only -1 for non-files, e.g. for things like snprintf(). I've verified that fileno(stdin) still returns 0 even when stdin is closed. This is true regardless of whether it is closed via fclose() in the current process or it inherits a closed fd at exec time. I don't really see any need for this diff. - todd