From: Paolo Bonzini Date: Tue, 26 Aug 2008 06:45:13 GMT Subject: Re: [PATCH v2 properly indented] fix start_command() bug when stdin is closed Message-ID: <48B3A679.2050103@gnu.org> In-Reply-To: <7vbpzgb94q.fsf@gitster.siamese.dyndns.org> Hannes already answered everything, but now that I think more about it I would actually consider putting it in main, just in case an important file ends up in file descriptor = 2 and is corrupted by a call to die(). Just in case, this program shows that stderr always point to fd 2 even if it is closed upon launch: #include #include int main() { int fd = open ("/dev/tty", O_WRONLY); FILE *fp; fp = fdopen (fd, "w"); fprintf (fp, "file descriptor %d\n", fd); fflush (fp); fprintf (stderr, "writing on stderr now\n"); } bonzinip$ ./a.out 2<&- file descriptor 2 writing on stderr now bonzinip$ Patch coming in a moment. Paolo