diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-02-02 02:26:48 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-02-02 02:26:48 +0000 |
commit | 46e9880c625972c3a9ac7c0b53bc1a30c2989b7c (patch) | |
tree | da4dba64cb6e03010ca03d7e31029700d0f9ff35 /gdb/utils.c | |
parent | 37a105a123de409e6d33eacc1030d1bebe5b1637 (diff) | |
download | gdb-46e9880c625972c3a9ac7c0b53bc1a30c2989b7c.zip gdb-46e9880c625972c3a9ac7c0b53bc1a30c2989b7c.tar.gz gdb-46e9880c625972c3a9ac7c0b53bc1a30c2989b7c.tar.bz2 |
* printcmd.c (printf_command): Make format string checking
stricter. Add separate cases for long_arg, ptr_arg, and
long_double_arg.
* utils.c (xstrvprintf): Improve the error message issued
for a bad format string.
* Makefile.in (GDB_WARN_CFLAGS_NO_FORMAT, INTERNAL_CFLAGS_BASE):
New variables.
(gnu-v3-abi.o, monitor.o, procfs.o, linux-thread-db.o): Remove
$(NO_WERROR_CFLAGS).
(printcmd.o): Likewise. Use $(GDB_WARN_CFLAGS_NO_FORMAT) and
enable -Werror.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index fdebbdc..dff5cb8 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1,8 +1,8 @@ /* General utility routines for GDB, the GNU debugger. Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free - Software Foundation, Inc. + 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GDB. @@ -1069,14 +1069,12 @@ xstrvprintf (const char *format, va_list ap) { char *ret = NULL; int status = vasprintf (&ret, format, ap); - /* NULL is returned when there was a memory allocation problem. */ - if (ret == NULL) - nomem (0); - /* A negative status (the printed length) with a non-NULL buffer - should never happen, but just to be sure. */ - if (status < 0) - internal_error (__FILE__, __LINE__, - _("vasprintf call failed (errno %d)"), errno); + /* NULL is returned when there was a memory allocation problem, or + any other error (for instance, a bad format string). A negative + status (the printed length) with a non-NULL buffer should never + happen, but just to be sure. */ + if (ret == NULL || status < 0) + internal_error (__FILE__, __LINE__, _("vasprintf call failed")); return ret; } |