From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, ishii(at)postgresql(dot)org |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: pgbench on mingw needs fflush |
Date: | 2007-03-13 08:09:15 |
Message-ID: | 20070313163915.60A4.ITAGAKI.TAKAHIRO@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2007-03-13 08:22:17 | Re: guc patch: Make variables fall back to default values |
Previous Message | Tom Lane | 2007-03-13 08:05:37 | Re: guc patch: Make variables fall back to default values |