From: Filip Navara <filip.navara@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/5] Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32
Date: Mon, 27 Jul 09 10:02:04 Central Europe Standard Time [thread overview]
Message-ID: <E1MVL9t-0001cm-94@lists.gnu.org> (raw)
On Win32 the setvbuf function requires the last parameter to be size between 2 and INT_MAX bytes, so the calls always failed. Since the whole point of the calls is to set line-buffered mode for the file handle and that's not supported on Win32 anyway, conditionally remove them.
Signed-off-by: Filip Navara <filip.navara@gmail.com>
---
exec.c | 3 ++-
vl.c | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/exec.c b/exec.c
index 7d3eb1a..ef79d6d 100644
--- a/exec.c
+++ b/exec.c
@@ -1491,7 +1491,8 @@ void cpu_set_log(int log_flags)
static char logfile_buf[4096];
setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
}
-#else
+#elif !defined(_WIN32)
+ /* Win32 doesn't support line-buffering and requires size >= 2 */
setvbuf(logfile, NULL, _IOLBF, 0);
#endif
log_append = 1;
diff --git a/vl.c b/vl.c
index ce213c2..d4e49e4 100644
--- a/vl.c
+++ b/vl.c
@@ -5735,7 +5735,10 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
+#ifndef _WIN32
+ /* Win32 doesn't support line-buffering and requires size >= 2 */
setvbuf(stdout, NULL, _IOLBF, 0);
+#endif
init_timers();
if (init_timer_alarm() < 0) {
--
1.6.3.2.1299.gee46c
next reply other threads:[~2009-07-27 8:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-27 8:02 Filip Navara [this message]
2009-07-27 13:21 ` [Qemu-devel] [PATCH 3/5] Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32 Daniel Jacobowitz
2009-07-27 13:33 ` Filip Navara
2009-07-27 13:42 ` Daniel Jacobowitz
2009-07-27 14:25 ` Filip Navara
2009-07-27 14:32 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1MVL9t-0001cm-94@lists.gnu.org \
--to=filip.navara@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.