1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Thread-secure error(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2013-09-03 16:30:43 +02:00
parent 1ddd404ff9
commit 48edf99373

View file

@ -31,16 +31,21 @@
extern "C" void gnu_error(int status, int errnum, const char *format, ...)
{
fprintf(stderr, "%s: ", program_invocation_name);
flockfile(stderr);
fprintf_unlocked(stderr, "%s: ", program_invocation_name);
va_list list;
va_start(list, format);
vfprintf(stderr, format, list);
vfprintf_unlocked(stderr, format, list);
va_end(list);
if ( errnum )
fprintf(stderr, ": %s", strerror(errnum));
fprintf(stderr, "\n");
fprintf_unlocked(stderr, ": %s", strerror(errnum));
fprintf_unlocked(stderr, "\n");
funlockfile(stderr);
if ( status )
exit(status);
}