Commit 27db3095 authored by Ferenc Wagner's avatar Ferenc Wagner Committed by Alexandre Julliard

Don't expect stdout be usable after exchanging file descriptors under

it.
parent 29623c2e
......@@ -335,8 +335,6 @@ run_tests (char *logname, const char *tag)
SetErrorMode (SEM_FAILCRITICALERRORS);
if (!(wineloader = getenv("WINELOADER"))) wineloader = "wine";
if (setvbuf (stdout, NULL, _IONBF, 0))
report (R_FATAL, "Can't unbuffer output.");
tempdir = tempnam (0, "wct");
if (!tempdir)
......
......@@ -19,6 +19,7 @@
*
*/
#include <windows.h>
#include <unistd.h>
#include <errno.h>
#include "winetest.h"
......@@ -39,26 +40,14 @@ void *xrealloc (void *op, size_t len)
return p;
}
void xprintf (const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
if (vprintf (fmt, ap) < 0)
report (R_FATAL, "Can't write logs: %d", errno);
va_end (ap);
}
char *vstrmake (size_t *lenp, va_list ap)
char *vstrfmtmake (size_t *lenp, const char *fmt, va_list ap)
{
char *fmt;
size_t size = 1000;
char *p, *q;
int n;
p = malloc (size);
if (!p) return NULL;
fmt = va_arg (ap, char*);
while (1) {
n = vsnprintf (p, size, fmt, ap);
if (n < 0) size *= 2; /* Windows */
......@@ -75,6 +64,14 @@ char *vstrmake (size_t *lenp, va_list ap)
return p;
}
char *vstrmake (size_t *lenp, va_list ap)
{
const char *fmt;
fmt = va_arg (ap, const char*);
return vstrfmtmake (lenp, fmt, ap);
}
char *strmake (size_t *lenp, ...)
{
va_list ap;
......@@ -87,6 +84,26 @@ char *strmake (size_t *lenp, ...)
return p;
}
void xprintf (const char *fmt, ...)
{
va_list ap;
size_t size;
ssize_t written;
char *buffer, *head;
va_start (ap, fmt);
buffer = vstrfmtmake (&size, fmt, ap);
head = buffer;
va_end (ap);
while ((written = write (1, head, size)) != size) {
if (written == -1)
report (R_FATAL, "Can't write logs: %d", errno);
head += written;
size -= written;
}
free (buffer);
}
char *
badtagchar (char *tag)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment