/[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.256 Revision 1.257
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.256 2013/04/08 06:38:42 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.257 2013/04/10 22:27:20 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.256 2013/04/08 06:38:42 vapier Exp $"; 10static const char rcsid[] = "$Id: scanelf.c,v 1.257 2013/04/10 22:27:20 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 == '+')
580 (unsigned long)offset_tmp, \ 580 (unsigned long)offset_tmp, \
581 (unsigned long)end_addr, \ 581 (unsigned long)end_addr, \
582 elf->filename, \ 582 elf->filename, \
583 (unsigned long)r_offset); \ 583 (unsigned long)r_offset); \
584 fflush(stdout); \ 584 fflush(stdout); \
585 if (system(sysbuf)) /* don't care */; \ 585 if (system(sysbuf)) {/* don't care */} \
586 fflush(stdout); \ 586 fflush(stdout); \
587 free(sysbuf); \ 587 free(sysbuf); \
588 } \ 588 } \
589 } \ 589 } \
590 } } 590 } }
901{ 901{
902 return NULL; 902 return NULL;
903} 903}
904#endif 904#endif
905 905
906static char *lookup_config_lib(elfobj *elf, char *fname) 906static char *lookup_config_lib(const char *fname)
907{ 907{
908 static char buf[__PAX_UTILS_PATH_MAX] = ""; 908 static char buf[__PAX_UTILS_PATH_MAX] = "";
909 const char *ldpath; 909 const char *ldpath;
910 size_t n; 910 size_t n;
911 911
963 if (op == 0) { \ 963 if (op == 0) { \
964 /* -n -> print all entries */ \ 964 /* -n -> print all entries */ \
965 if (!be_wewy_wewy_quiet) { \ 965 if (!be_wewy_wewy_quiet) { \
966 if (*found_needed) xchrcat(ret, ',', ret_len); \ 966 if (*found_needed) xchrcat(ret, ',', ret_len); \
967 if (use_ldpath) { \ 967 if (use_ldpath) { \
968 if ((p = lookup_config_lib(elf, needed)) != NULL) \ 968 if ((p = lookup_config_lib(needed)) != NULL) \
969 needed = p; \ 969 needed = p; \
970 } else if (use_ldcache) { \ 970 } else if (use_ldcache) { \
971 if ((p = lookup_cache_lib(elf, needed)) != NULL) \ 971 if ((p = lookup_cache_lib(elf, needed)) != NULL) \
972 needed = p; \ 972 needed = p; \
973 } \ 973 } \
1039 SHOW_PT_INTERP(64) 1039 SHOW_PT_INTERP(64)
1040 } 1040 }
1041 1041
1042 return NULL; 1042 return NULL;
1043} 1043}
1044static char *scanelf_file_bind(elfobj *elf, char *found_bind) 1044static const char *scanelf_file_bind(elfobj *elf, char *found_bind)
1045{ 1045{
1046 unsigned long i; 1046 unsigned long i;
1047 struct stat s; 1047 struct stat s;
1048 char dynamic = 0; 1048 char dynamic = 0;
1049 1049
1082 /* don't output anything if quiet mode and the ELF is static or not setuid */ 1082 /* don't output anything if quiet mode and the ELF is static or not setuid */
1083 if (be_quiet && (!dynamic || (!fstat(elf->fd, &s) && !(s.st_mode & (S_ISUID|S_ISGID))))) { 1083 if (be_quiet && (!dynamic || (!fstat(elf->fd, &s) && !(s.st_mode & (S_ISUID|S_ISGID))))) {
1084 return NULL; 1084 return NULL;
1085 } else { 1085 } else {
1086 *found_bind = 1; 1086 *found_bind = 1;
1087 return (char *)(dynamic ? "LAZY" : "STATIC"); 1087 return dynamic ? "LAZY" : "STATIC";
1088 } 1088 }
1089} 1089}
1090static char *scanelf_file_soname(elfobj *elf, char *found_soname) 1090static char *scanelf_file_soname(elfobj *elf, char *found_soname)
1091{ 1091{
1092 unsigned long i; 1092 unsigned long i;
1827 1827
1828 fclose(fp); 1828 fclose(fp);
1829 1829
1830 if (curr_fd != -1) { 1830 if (curr_fd != -1) {
1831 if (fchdir(curr_fd)) 1831 if (fchdir(curr_fd))
1832 /* don't care */; 1832 {/* don't care */}
1833 close(curr_fd); 1833 close(curr_fd);
1834 } 1834 }
1835 1835
1836 return 0; 1836 return 0;
1837} 1837}

Legend:
Removed from v.1.256  
changed lines
  Added in v.1.257

  ViewVC Help
Powered by ViewVC 1.1.20