summary refs log tree commit diff
path: root/misc/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/error.c')
-rw-r--r--misc/error.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/misc/error.c b/misc/error.c
index 86d49a52a6..8306fd569f 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -28,6 +28,7 @@
 #include <libintl.h>
 #ifdef _LIBC
 # include <wchar.h>
+# define mbsrtowcs __mbsrtowcs
 #endif
 
 #if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
@@ -225,7 +226,11 @@ error (status, errnum, message, va_alist)
 
   fflush (stdout);
 #ifdef _LIBC
-  flockfile (stderr);
+# ifdef USE_IN_LIBIO
+  _IO_flockfile (stderr);
+# else
+  __flockfile (stderr);
+# endif
 #endif
   if (error_print_progname)
     (*error_print_progname) ();
@@ -242,9 +247,6 @@ error (status, errnum, message, va_alist)
 #ifdef VA_START
   VA_START (args, message);
   error_tail (status, errnum, message, args);
-# ifdef _LIBC
-  funlockfile (stderr);
-# endif
 #else
   fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
 
@@ -256,6 +258,14 @@ error (status, errnum, message, va_alist)
   if (status)
     exit (status);
 #endif
+
+#ifdef _LIBC
+# ifdef USE_IN_LIBIO
+  _IO_funlockfile (stderr);
+# else
+  __funlockfile (stderr);
+# endif
+#endif
 }
 
 /* Sometimes we want to have at most one error per line.  This
@@ -297,7 +307,11 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
 
   fflush (stdout);
 #ifdef _LIBC
-  flockfile (stderr);
+# ifdef USE_IN_LIBIO
+  _IO_flockfile (stderr);
+# else
+  __flockfile (stderr);
+# endif
 #endif
   if (error_print_progname)
     (*error_print_progname) ();
@@ -324,9 +338,6 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
 #ifdef VA_START
   VA_START (args, message);
   error_tail (status, errnum, message, args);
-# ifdef _LIBC
-  funlockfile (stderr);
-# endif
 #else
   fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
 
@@ -338,6 +349,14 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
   if (status)
     exit (status);
 #endif
+
+#ifdef _LIBC
+# ifdef USE_IN_LIBIO
+  _IO_funlockfile (stderr);
+# else
+  __funlockfile (stderr);
+# endif
+#endif
 }
 
 #ifdef _LIBC