diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | bootstrap.conf | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/printf.c | 37 |
4 files changed, 29 insertions, 19 deletions
@@ -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 diff --git a/bootstrap.conf b/bootstrap.conf index 9584dc069..d07c23e35 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -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 " diff --git a/po/POTFILES.in b/po/POTFILES.in index 70616bb56..686332df6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/src/printf.c b/src/printf.c index 7f87f3f65..483f3a98c 100644 --- a/src/printf.c +++ b/src/printf.c @@ -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; } |