On Thu, Jun 28, 2007 at 11:48:38PM -0400, Theodore Tso wrote: > +void maybe_flush_or_die(FILE *f, const char *desc) > +{ > + static int stdout_is_file = -1; > + struct stat st; > + char *cp; > + > + if (f == stdout) { > + if (stdout_is_file < 0) { > + cp = getenv("GIT_FLUSH"); > + if (cp) > + stdout_is_file = (atoi(cp) == 0); > + else if ((fstat(fileno(stdout), &st) == 0) && > + S_ISREG(st.st_mode)) > + stdout_is_file = 1; > + else > + stdout_is_file = 0; > + } > + if (stdout_is_file) > + return; > + } Looks much better to me, but I have one minor nit: stdout_is_file is a poor name, since it can mean either that stdout is a file, or that flushing was explicitly turned off. Naming it something like stdout_wants_flush would make much more sense. Though it's not a huge deal since the function is fairly short, I think it makes things a little easier to read (I had to double-check the negation on atoi(cp) == 0 before I convinced myself the code was correct). -Peff - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html