]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Detect printf(3) failure due to ENOMEM.
authorJim Meyering <meyering@redhat.com>
Sat, 20 Oct 2007 12:48:29 +0000 (14:48 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 21 Oct 2007 12:01:27 +0000 (14:01 +0200)
* src/printf.c: Include "xprintf.h"
(print_direc): Use xprintf, rather than printf.
* bootstrap.conf (gnulib_modules): Add xprintf.
* po/POTFILES.in: Add lib/xprintf.c.

Signed-off-by: Jim Meyering <meyering@redhat.com>
ChangeLog
bootstrap.conf
po/POTFILES.in
src/printf.c

index ab0562967f86df5ec30419886c641086097d9032..fdbabe826fcf889aca03831d0e4935a6e353b007 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-10-20  Jim Meyering  <meyering@redhat.com>
 
+       Detect printf(3) failure due to ENOMEM.
+       * src/printf.c: Include "xprintf.h"
+       (print_direc): Use xprintf, rather than printf.
+       * bootstrap.conf (gnulib_modules): Add xprintf.
+       * po/POTFILES.in: Add lib/xprintf.c.
+
        Put always-failing programs first in PATH, so tests cannot mistakenly
        run installed versions.
        * Makefile.maint (my-distcheck): Set up a bogus bin/ dir, to be used
index 9584dc06926bff424b3d63fc06504bb6ad133804..d07c23e352cb22ba6a58b89ee3922530c3b02b88 100644 (file)
@@ -81,7 +81,9 @@ gnulib_modules="
        verify version-etc-fsf
        wcwidth winsz-ioctl winsz-termios write-any-file
        xalloc xgetcwd xgethostname
-       xmemcoll xnanosleep xstrtod xstrtoimax
+       xmemcoll xnanosleep
+       xprintf
+       xstrtod xstrtoimax
        xstrtol xstrtold xstrtoumax yesno
 "
 
index 70616bb5631b42e0d80bb6b6562722da9030e48b..686332df6c571d862bb810757c1740d5212943ef 100644 (file)
@@ -26,6 +26,7 @@ lib/xalloc-die.c
 lib/xfts.c
 lib/xmemcoll.c
 lib/xmemxfrm.c
+lib/xprintf.c
 lib/xstrtol-error.c
 
 # Package source files
index 7f87f3f65a04258713a60b92fecd334a6273f725..483f3a98c382db5d8a88e41d9d9ecd21122d4784 100644 (file)
@@ -56,6 +56,7 @@
 #include "long-options.h"
 #include "quote.h"
 #include "unicodeio.h"
+#include "xprintf.h"
 
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "printf"
@@ -373,16 +374,16 @@ print_direc (const char *start, size_t length, char conversion,
        if (!have_field_width)
          {
            if (!have_precision)
-             printf (p, arg);
+             xprintf (p, arg);
            else
-             printf (p, precision, arg);
+             xprintf (p, precision, arg);
          }
        else
          {
            if (!have_precision)
-             printf (p, field_width, arg);
+             xprintf (p, field_width, arg);
            else
-             printf (p, field_width, precision, arg);
+             xprintf (p, field_width, precision, arg);
          }
       }
       break;
@@ -396,16 +397,16 @@ print_direc (const char *start, size_t length, char conversion,
        if (!have_field_width)
          {
            if (!have_precision)
-             printf (p, arg);
+             xprintf (p, arg);
            else
-             printf (p, precision, arg);
+             xprintf (p, precision, arg);
          }
        else
          {
            if (!have_precision)
-             printf (p, field_width, arg);
+             xprintf (p, field_width, arg);
            else
-             printf (p, field_width, precision, arg);
+             xprintf (p, field_width, precision, arg);
          }
       }
       break;
@@ -423,41 +424,41 @@ print_direc (const char *start, size_t length, char conversion,
        if (!have_field_width)
          {
            if (!have_precision)
-             printf (p, arg);
+             xprintf (p, arg);
            else
-             printf (p, precision, arg);
+             xprintf (p, precision, arg);
          }
        else
          {
            if (!have_precision)
-             printf (p, field_width, arg);
+             xprintf (p, field_width, arg);
            else
-             printf (p, field_width, precision, arg);
+             xprintf (p, field_width, precision, arg);
          }
       }
       break;
 
     case 'c':
       if (!have_field_width)
-       printf (p, *argument);
+       xprintf (p, *argument);
       else
-       printf (p, field_width, *argument);
+       xprintf (p, field_width, *argument);
       break;
 
     case 's':
       if (!have_field_width)
        {
          if (!have_precision)
-           printf (p, argument);
+           xprintf (p, argument);
          else
-           printf (p, precision, argument);
+           xprintf (p, precision, argument);
        }
       else
        {
          if (!have_precision)
-           printf (p, field_width, argument);
+           xprintf (p, field_width, argument);
          else
-           printf (p, field_width, precision, argument);
+           xprintf (p, field_width, precision, argument);
        }
       break;
     }