[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Re: 4.0 core dump from printf -v foo %s b
From: |
Greg Wooledge |
Subject: |
[PATCH] Re: 4.0 core dump from printf -v foo %s b |
Date: |
Thu, 12 Nov 2009 17:13:29 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Nov 12, 2009 at 02:37:58PM -0500, Chet Ramey wrote:
> I try to write to the current (well, ten-year-old) standards. The
> replacement in lib/sh/snprintf.c behaves as C99 specifies; you might try
> using it by #undefing HAVE_VSNPRINTF and HAVE_SNPRINTF in config.h.
Ah, wonderful. I wasted a bit of time looking for a replacement
vsnprintf function on the Internet, but you already have one. ;-)
That worked. (Note to self: not #define HAVE_FOO 0. It has to be #undef.)
Here's a patch that tries to do this automatically. I wanted to make
it simpler, preferably doing something like "AC_UNDEFINE(HAVE_FOO)" if it
fails, but apparently that's not possible. Hence, the ugly SNPRINTF_BROKEN
definition and the multiple touched files.
One potential issue with this patch: I noticed that there's an existing
autoconf macro for systems that require a special _KERNEL definition to
use the RLIMIT_* constants in setrlimit(). This patch doesn't know
about that, unfortunately, and I wasn't sure how to do that properly in
autoconf.
Tested & worked on HP-UX 10.20.
bash-4.0-snprintf.diff
Description: Text document