mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 22:50:43 +00:00
Don't expect stdout be usable after exchanging file descriptors under
it.
This commit is contained in:
parent
29623c2e6b
commit
27db309518
@ -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, ...)
|
||||
char *vstrfmtmake (size_t *lenp, const char *fmt, va_list ap)
|
||||
{
|
||||
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 *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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user