This is the mail archive of the
mailing list for the binutils project.
Re: PATCH: binutils/3384: readelf displays shortened program interpreter path
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Sun, 29 Oct 2006 11:08:03 -0800
- Subject: Re: PATCH: binutils/3384: readelf displays shortened program interpreter path
- References: <20061023171447.GA24989@lucon.org> <email@example.com>
On Sun, Oct 29, 2006 at 08:17:29AM +0000, Nick Clifton wrote:
> Hi H. J.
> >2006-10-24 H.J. Lu <firstname.lastname@example.org>
> > PR binutils/3384
> > * configure.in (AC_CHECK_HEADERS): Add limits.h and sys/param.h.
> > * configure: Regenerated.
> > * config.in: Likewise.
> > * readelf.c: Include <limits.h> and <sys/param.h> for PATH_MAX.
> > (program_interpreter): Allocate PATH_MAX bytes instead of 64.
> > (process_program_headers): Don't assume that program interpreter
> > is shorter than 64 characters.
> Approved, please apply, but...
> >+ char fmt ;
> >+ int ret = snprintf (fmt, sizeof (fmt), "%%%ds", PATH_MAX);
> >+ if (ret >= (int) sizeof (fmt) || ret < 0)
> >+ error (_("Failed to print program interpreter name\n"));
> It strikes me that this error message is wrong. Since what we have
> failed to do is to construct a format string that can be used to print
> the program interpreter name. Since this should never reasonably happen
> (PATH_MAX would have to be a huge number), this really ought to be an
> internal error. So how about:
> error (_("Internal error: failed to create format string to display
> program interpreter"));
Done. I checked it in.