summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2007-11-07 21:26:32 +0000
committerChristos Zoulas <christos@zoulas.com>2007-11-07 21:26:32 +0000
commit94dacf689c123398917c9824fffb94644485cb5c (patch)
tree9f6691863d0d2dc6b743927947bb25d189e0c983 /src
parent10e20444a90775c23a9e3850a9680aac4584490f (diff)
downloadfile-git-94dacf689c123398917c9824fffb94644485cb5c.tar.gz
print > 16 char file names in core files.
Diffstat (limited to 'src')
-rw-r--r--src/readelf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/readelf.c b/src/readelf.c
index a05cb319..793ead67 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.64 2007/09/26 20:42:55 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.65 2007/10/23 19:54:35 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;