From: Christos Zoulas Date: Wed, 7 Nov 2007 21:26:32 +0000 (+0000) Subject: print > 16 char file names in core files. X-Git-Tag: FILE5_05~574 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76313a9c7a89b3e45b70f951da555b853827f7a5;p=file print > 16 char file names in core files. --- diff --git a/src/readelf.c b/src/readelf.c index 69c55149..fe362fab 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -37,7 +37,7 @@ #include "readelf.h" #ifndef lint -FILE_RCSID("@(#)$File: readelf.c,v 1.65 2007/10/23 19:54:35 christos Exp $") +FILE_RCSID("@(#)$File: readelf.c,v 1.66 2007/11/07 21:26:32 christos Exp $") #endif #ifdef ELFCORE @@ -637,6 +637,7 @@ core: * reject it. */ for (i = 0; i < NOFFSETS; i++) { + unsigned char *cname, *cp; size_t reloffset = prpsoffsets(i); size_t noffset = doff + reloffset; for (j = 0; j < 16; j++, noffset++, @@ -684,8 +685,12 @@ core: /* * Well, that worked. */ - if (file_printf(ms, ", from '%.16s'", - &nbuf[doff + prpsoffsets(i)]) == -1) + cname = (unsigned char *) + &nbuf[doff + prpsoffsets(i)]; + for (cp = cname; *cp && isprint(*cp); cp++) + continue; + if (file_printf(ms, ", from '%.*s'", + (int)(cp - cname), cp) == -1) return size; *flags |= FLAGS_DID_CORE; return size;