diff --git a/src/elfclass.h b/src/elfclass.h
index 27817d0..7f3da86 100644
--- a/src/elfclass.h
+++ b/src/elfclass.h
@@ -35,6 +35,7 @@
switch (type) {
#ifdef ELFCORE
case ET_CORE:
+ flags |= FLAGS_IS_CORE;
if (dophn_core(ms, clazz, swap, fd,
(off_t)elf_getu(swap, elfhdr.e_phoff),
elf_getu16(swap, elfhdr.e_phnum),
diff --git a/src/readelf.c b/src/readelf.c
index 5915569..24aa28c 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -286,6 +286,7 @@ private const char os_style_names[][8] = {
#define FLAGS_DID_CORE 1
#define FLAGS_DID_NOTE 2
#define FLAGS_DID_CORE_STYLE 4
+#define FLAGS_IS_CORE 8
private int
dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
@@ -676,7 +677,7 @@ core:
break;
default:
- if (xnh_type == NT_PRPSINFO) {
+ if (xnh_type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
size_t i, j;
unsigned char c;
/*