Import upstream version 1.29
[debian/tar] / gnu / error.c
index 5f929df659a1481c3b3e7a38e8db84a7690de8fa..0ac769518533d757273c929a5008dbb57df490b3 100644 (file)
@@ -1,7 +1,5 @@
-/* -*- buffer-read-only: t -*- vi: set ro: */
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007, 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007, 2009-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -41,6 +39,9 @@
 # include <stdint.h>
 # include <wchar.h>
 # define mbsrtowcs __mbsrtowcs
+# define USE_UNLOCKED_IO 0
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b)
+# define _GL_ARG_NONNULL(a)
 #endif
 
 #if USE_UNLOCKED_IO
@@ -74,14 +75,14 @@ extern void __error (int status, int errnum, const char *message, ...)
 extern void __error_at_line (int status, int errnum, const char *file_name,
                              unsigned int line_number, const char *message,
                              ...)
-     __attribute__ ((__format__ (__printf__, 5, 6)));;
+     __attribute__ ((__format__ (__printf__, 5, 6)));
 # define error __error
 # define error_at_line __error_at_line
 
 # include <libio/iolibio.h>
-# define fflush(s) INTUSE(_IO_fflush) (s)
+# define fflush(s) _IO_fflush (s)
 # undef putc
-# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
+# define putc(c, fp) _IO_putc (c, fp)
 
 # include <bits/libc-lock.h>
 
@@ -173,7 +174,7 @@ print_errno_message (int errnum)
 
 #if defined HAVE_STRERROR_R || _LIBC
   char errbuf[1024];
-# if STRERROR_R_CHAR_P || _LIBC
+# if _LIBC || STRERROR_R_CHAR_P
   s = __strerror_r (errnum, errbuf, sizeof errbuf);
 # else
   if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
@@ -203,7 +204,6 @@ error_tail (int status, int errnum, const char *message, va_list args)
 #if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     {
-# define ALLOCA_LIMIT 2000
       size_t len = strlen (message) + 1;
       wchar_t *wmessage = NULL;
       mbstate_t st;
@@ -239,7 +239,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
           if (res != len)
             break;
 
-          if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+          if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
             {
               /* This really should not happen if everything is fine.  */
               res = (size_t) -1;
@@ -344,7 +344,10 @@ error_at_line (int status, int errnum, const char *file_name,
 
       if (old_line_number == line_number
           && (file_name == old_file_name
-              || strcmp (old_file_name, file_name) == 0))
+              || (old_file_name != NULL
+                  && file_name != NULL
+                  && strcmp (old_file_name, file_name) == 0)))
+
         /* Simply return and print nothing.  */
         return;
 
@@ -376,10 +379,10 @@ error_at_line (int status, int errnum, const char *file_name,
     }
 
 #if _LIBC
-  __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
+  __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ",
               file_name, line_number);
 #else
-  fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
+  fprintf (stderr, file_name != NULL ? "%s:%u: " : " ",
            file_name, line_number);
 #endif