Tatsuo Ishii <ishii@sraoss.co.jp> wrote:
> Can we distinguish mingw case from others so that we could ifdef out
> the extra fflush()?
> > The buffered stderr might be a bug of mingw
After a little research, I found that MSDN says the buffered stderr is
a specifications on Windows somehow, not a bug.
setvbuf() is better solution for the problem.
This is more simple and no need to use ifdef.
*** pgbench.c.orig Mon Jan 22 11:17:30 2007
--- pgbench.c Tue Mar 13 17:01:12 2007
*************** main(int argc, char **argv)
*** 1184,1189 ****
--- 1184,1192 ----
char val[64];
+ /* stderr is buffered on Win32. */
+ setvbuf(stderr, NULL, _IONBF, 0);
+
if ((env = getenv("PGHOST")) != NULL && *env != '\0')
pghost = env;
if ((env = getenv("PGPORT")) != NULL && *env != '\0')
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center