/[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.262 Revision 1.263
1/* 1/*
2 * Copyright 2003-2012 Gentoo Foundation 2 * Copyright 2003-2012 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.262 2014/03/20 08:06:01 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.263 2014/03/20 08:08:37 vapier Exp $
5 * 5 *
6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10static const char rcsid[] = "$Id: scanelf.c,v 1.262 2014/03/20 08:06:01 vapier Exp $"; 10static const char rcsid[] = "$Id: scanelf.c,v 1.263 2014/03/20 08:08:37 vapier Exp $";
11const char argv0[] = "scanelf"; 11const char argv0[] = "scanelf";
12 12
13#include "paxinc.h" 13#include "paxinc.h"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
1552 int ret = 1; 1552 int ret = 1;
1553 size_t n; 1553 size_t n;
1554 const char *match_etype; 1554 const char *match_etype;
1555 elfobj *elf; 1555 elfobj *elf;
1556 1556
1557 /* verify this is real ELF */ 1557 /* Verify this is a real ELF */
1558 if ((elf = _readelf_fd(filename, fd, len, !fix_elf)) == NULL) { 1558 if ((elf = _readelf_fd(filename, fd, len, !fix_elf)) == NULL) {
1559 if (be_verbose > 2) printf("%s: not an ELF\n", filename); 1559 if (be_verbose > 2) printf("%s: not an ELF\n", filename);
1560 return 2; 1560 return 2;
1561 } 1561 }
1562
1563 /* Possibly filter based on ELF bitness */
1562 switch (match_bits) { 1564 switch (match_bits) {
1563 case 32: 1565 case 32:
1564 if (elf->elf_class != ELFCLASS32) 1566 if (elf->elf_class != ELFCLASS32)
1565 goto label_done; 1567 goto done;
1566 break; 1568 break;
1567 case 64: 1569 case 64:
1568 if (elf->elf_class != ELFCLASS64) 1570 if (elf->elf_class != ELFCLASS64)
1569 goto label_done; 1571 goto done;
1570 break; 1572 break;
1571 default: break;
1572 } 1573 }
1573 1574
1575 /* Possibly filter based on the ELF's e_type field */
1574 array_for_each(match_etypes, n, match_etype) 1576 array_for_each(match_etypes, n, match_etype)
1575 if (etype_lookup(match_etype) == get_etype(elf)) 1577 if (etype_lookup(match_etype) == get_etype(elf))
1576 goto label_ret; 1578 goto scanit;
1577 if (array_cnt(match_etypes)) 1579 if (array_cnt(match_etypes))
1578 goto label_done; 1580 goto done;
1579 1581
1580label_ret: 1582 scanit:
1581 ret = scanelf_elfobj(elf); 1583 ret = scanelf_elfobj(elf);
1582 1584
1583label_done: 1585 done:
1584 unreadelf(elf); 1586 unreadelf(elf);
1585 return ret; 1587 return ret;
1586} 1588}
1587 1589
1588/* scan an archive of elfs */ 1590/* scan an archive of elfs */

Legend:
Removed from v.1.262  
changed lines
  Added in v.1.263

  ViewVC Help
Powered by ViewVC 1.1.20