- fix #599695 - try to get "from" attribute for ELF binaries only from core

dumps.
This commit is contained in:
Jan Kaluža 2010-07-19 15:30:25 +00:00
parent de40b3ba76
commit d225ab0d21
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,33 @@
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;
/*

View File

@ -5,7 +5,7 @@
Summary: A utility for determining file types
Name: file
Version: 5.04
Release: 11%{?dist}
Release: 12%{?dist}
License: BSD
Group: Applications/File
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@ -22,6 +22,7 @@ Patch8: file-5.04-core-trim.patch
Patch9: file-5.04-retval.patch
Patch10: file-5.04-html-regression.patch
Patch11: file-5.04-zmachine-magic-update.patch
Patch12: file-5.04-core-prpsinfo.patch
Requires: file-libs = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -96,6 +97,8 @@ file(1) command.
%patch10 -p1
#fixes #608922
%patch11 -p1
#fixes #599695
%patch12 -p1
iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
touch -r doc/libmagic.man doc/libmagic.man_
@ -173,6 +176,10 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Thu Jul 19 2010 Jan Kaluza <jkaluza@redhat.com> 5.04-12
- fix #599695 - try to get "from" attribute for ELF binaries
only from core dumps.
* Thu Jul 08 2010 Jan Kaluza <jkaluza@redhat.com> 5.04-11
- added docs for file-libs