This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: [Patch] cygcheck: eprintf + display_error: Do /something/.
Op Mon, 20 Dec 2004 11:32:16 +0100 schreef Corinna Vinschen
in <20041220103216.GM9277@cygbert.vinschen.de>:
: On Dec 17 21:59, Bas van Gompel wrote:
: > Op Fri, 17 Dec 2004 10:43:01 +0100 schreef Corinna Vinschen
: > : Hmm, if stderr is not unbuffered in mingw, then that should be fixed
: > : in mingw, shouldn't it?
: >
: > I guess so...
: >
: > I'll try and look into this, if noone else does.
Danny does not seem inclined to apply my patch...
I'll try once more.
: > What about the patch? It shouldn't hurt, and the flush of stderr can
: > be removed, once this has been fixed in mingw.
:
: I'd rather see a fix than a workaround, if that's possible. You know
: that the typical lifetime of a workaround is a multiple of the lifetime
: of the actual problem ;-)
True.
Here is a version which will work as expected iff the mingw-patch
gets accepted.
2004-12-23 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
* cygcheck.cc (eprintf): Flush stdout before output.
(display_error): Use eprintf.
--- src/winsup/utils/cygcheck.cc 18 Nov 2004 05:20:23 -0000 1.64
+++ src/winsup/utils/cygcheck.cc 22 Dec 2004 06:30:07 -0000
@@ -102,6 +102,9 @@ void
eprintf (const char *format, ...)
{
va_list ap;
+
+ fflush (stdout);
+
va_start (ap, format);
vfprintf (stderr, format, ap);
va_end (ap);
@@ -114,10 +118,10 @@ static int
display_error (const char *name, bool show_error = true, bool print_failed = true)
{
if (show_error)
- fprintf (stderr, "cygcheck: %s%s: %lu\n", name,
+ eprintf ("cygcheck: %s%s: %lu\n", name,
print_failed ? " failed" : "", GetLastError ());
else
- fprintf (stderr, "cygcheck: %s%s\n", name,
+ eprintf ("cygcheck: %s%s\n", name,
print_failed ? " failed" : "");
return 1;
}
L8r,
Buzz.
--
) | | ---/ ---/ Yes, this | This message consists of true | I do not
-- | | / / really is | and false bits entirely. | mail for
) | | / / a 72 by 4 +-------------------------------+ any1 but
-- \--| /--- /--- .sigfile. | |perl -pe "s.u(z)\1.as." | me. 4^re