File 0002-Stop-reporting-bad-capabilities-after-the-first-few.patch of Package file.278

From d7cdad007c507e6c79f51f058dd77fab70ceb9f6 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sat, 22 Nov 2014 23:57:44 +0000
Subject: [PATCH] Stop reporting bad capabilities after the first few.

---
 src/readelf.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git src/readelf.c src/readelf.c
index dd4672b..20fcb7f 100644
--- src/readelf.c
+++ src/readelf.c
@@ -919,6 +919,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 	Elf32_Shdr sh32;
 	Elf64_Shdr sh64;
 	int stripped = 1;
+	size_t nbadcap = 0;
 	void *nbuf;
 	off_t noff, coff, name_off;
 	uint64_t cap_hw1 = 0;	/* SunOS 5.x hardware capabilites */
@@ -1007,6 +1008,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 				goto skip;
 			}
 
+			if (nbadcap > 5)
+				break;
 			if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
 				file_badseek(ms);
 				return -1;
@@ -1072,6 +1075,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
 					    (unsigned long long)xcap_tag,
 					    (unsigned long long)xcap_val) == -1)
 						return -1;
+					if (nbadcap++ > 2)
+						coff = xsh_size;
 					break;
 				}
 			}
-- 
1.7.9.2

openSUSE Build Service is sponsored by