/[gentoo-projects]/pax-utils/scanelf.c
Gentoo

Diff of /pax-utils/scanelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.130 Revision 1.131
1/* 1/*
2 * Copyright 2003-2006 Gentoo Foundation 2 * Copyright 2003-2006 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.130 2006/02/21 00:31:53 solar Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.131 2006/03/02 14:40:53 solar Exp $
5 * 5 *
6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10#include "paxinc.h" 10#include "paxinc.h"
11 11
12static const char *rcsid = "$Id: scanelf.c,v 1.130 2006/02/21 00:31:53 solar Exp $"; 12static const char *rcsid = "$Id: scanelf.c,v 1.131 2006/03/02 14:40:53 solar Exp $";
13#define argv0 "scanelf" 13#define argv0 "scanelf"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#') 15#define IS_MODIFIER(c) (c == '%' || c == '#')
16 16
17 17
733} 733}
734static char *scanelf_file_bind(elfobj *elf, char *found_bind) 734static char *scanelf_file_bind(elfobj *elf, char *found_bind)
735{ 735{
736 unsigned long i; 736 unsigned long i;
737 struct stat s; 737 struct stat s;
738 char dynamic = 0;
738 739
739 if (!show_bind) return NULL; 740 if (!show_bind) return NULL;
740 if (!elf->phdr) return NULL; 741 if (!elf->phdr) return NULL;
741 742
742#define SHOW_BIND(B) \ 743#define SHOW_BIND(B) \
745 Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \ 746 Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
746 Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \ 747 Elf ## B ## _Phdr *phdr = PHDR ## B (elf->phdr); \
747 Elf ## B ## _Off offset; \ 748 Elf ## B ## _Off offset; \
748 for (i = 0; i < EGET(ehdr->e_phnum); i++) { \ 749 for (i = 0; i < EGET(ehdr->e_phnum); i++) { \
749 if (EGET(phdr[i].p_type) != PT_DYNAMIC) continue; \ 750 if (EGET(phdr[i].p_type) != PT_DYNAMIC) continue; \
751 dynamic = 1; \
750 offset = EGET(phdr[i].p_offset); \ 752 offset = EGET(phdr[i].p_offset); \
751 if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \ 753 if (offset >= elf->len - sizeof(Elf ## B ## _Dyn)) continue; \
752 dyn = DYN ## B (elf->data + offset); \ 754 dyn = DYN ## B (elf->data + offset); \
753 while (EGET(dyn->d_tag) != DT_NULL) { \ 755 while (EGET(dyn->d_tag) != DT_NULL) { \
754 if (EGET(dyn->d_tag) == DT_BIND_NOW || \ 756 if (EGET(dyn->d_tag) == DT_BIND_NOW || \
769 771
770 if (be_quiet && !fstat(elf->fd, &s) && !(s.st_mode & S_ISUID || s.st_mode & S_ISGID)) { 772 if (be_quiet && !fstat(elf->fd, &s) && !(s.st_mode & S_ISUID || s.st_mode & S_ISGID)) {
771 return NULL; 773 return NULL;
772 } else { 774 } else {
773 *found_bind = 1; 775 *found_bind = 1;
774 return (char *) "LAZY"; 776 return (char *) (dynamic ? "LAZY" : "STATIC");
775 } 777 }
776} 778}
777static char *scanelf_file_soname(elfobj *elf, char *found_soname) 779static char *scanelf_file_soname(elfobj *elf, char *found_soname)
778{ 780{
779 unsigned long i; 781 unsigned long i;

Legend:
Removed from v.1.130  
changed lines
  Added in v.1.131

  ViewVC Help
Powered by ViewVC 1.1.20