| 1 | /* |
1 | /* |
| 2 | * Copyright 2003-2007 Gentoo Foundation |
2 | * Copyright 2003-2007 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/scanelf.c,v 1.200 2008/12/10 20:06:20 grobian Exp $ |
4 | * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.201 2008/12/30 12:00:06 vapier Exp $ |
| 5 | * |
5 | * |
| 6 | * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org> |
6 | * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org> |
| 7 | * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org> |
7 | * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org> |
| 8 | */ |
8 | */ |
| 9 | |
9 | |
| 10 | static const char *rcsid = "$Id: scanelf.c,v 1.200 2008/12/10 20:06:20 grobian Exp $"; |
10 | static const char *rcsid = "$Id: scanelf.c,v 1.201 2008/12/30 12:00:06 vapier Exp $"; |
| 11 | const char * const argv0 = "scanelf"; |
11 | const char * const 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 == '+') |
| … | |
… | |
| 1332 | |
1332 | |
| 1333 | ar = ar_open_fd(filename, fd); |
1333 | ar = ar_open_fd(filename, fd); |
| 1334 | if (ar == NULL) |
1334 | if (ar == NULL) |
| 1335 | return 1; |
1335 | return 1; |
| 1336 | |
1336 | |
| 1337 | ar_buffer = (char*)mmap(0, len, PROT_READ | (fix_elf ? PROT_WRITE : 0), (fix_elf ? MAP_SHARED : MAP_PRIVATE), fd, 0); |
1337 | ar_buffer = mmap(0, len, PROT_READ | (fix_elf ? PROT_WRITE : 0), (fix_elf ? MAP_SHARED : MAP_PRIVATE), fd, 0); |
| 1338 | while ((m=ar_next(ar)) != NULL) { |
1338 | while ((m=ar_next(ar)) != NULL) { |
| 1339 | elf = readelf_buffer(m->name, ar_buffer+lseek(fd,0,SEEK_CUR), m->size); |
1339 | elf = readelf_buffer(m->name, ar_buffer+lseek(fd,0,SEEK_CUR), m->size); |
| 1340 | if (elf) { |
1340 | if (elf) { |
| 1341 | scanelf_elfobj(elf); |
1341 | scanelf_elfobj(elf); |
| 1342 | unreadelf(elf); |
1342 | unreadelf(elf); |