*/
#include "defs.h"
+
+#if USE_CUSTOM_PRINTF
+
#include <stdarg.h>
#include <limits.h>
-#ifdef USE_CUSTOM_PRINTF
+#ifndef HAVE_FPUTS_UNLOCKED
+# define fputs_unlocked fputs
+#endif
#define noinline_for_stack /*nothing*/
#define likely(expr) (expr)
int strace_vfprintf(FILE *fp, const char *fmt, va_list args)
{
- static char *buf;
- static unsigned buflen;
+ static char *buf = NULL;
+ static unsigned buflen = 0;
int r;
va_list a1;
buflen = len + 256;
free(buf);
buf = malloc(buflen);
+ if (!buf)
+ die_out_of_memory();
/*len =*/ kernel_vsnprintf(buf, buflen, fmt, args);
}