(void)line;
#endif
- fprintf(stdout,
+ /* Prevent another thread from interrupting the two printfs(). */
+ flockfile(stderr);
+
+ fprintf(stderr,
#ifdef DEBUG
"%-12s:%-3d "
#endif
#endif
level_string, (int)pthread_self());
va_start(ap, format);
- vfprintf(stdout, format, ap);
+ vfprintf(stderr, format, ap);
va_end(ap);
- fprintf(stdout, "\n");
+ fprintf(stderr, "\n");
+
+ funlockfile(stderr);
}