/[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.205 Revision 1.206
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.205 2008/12/30 13:13:15 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.206 2008/12/30 13:34:46 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
10static const char *rcsid = "$Id: scanelf.c,v 1.205 2008/12/30 13:13:15 vapier Exp $"; 10static const char *rcsid = "$Id: scanelf.c,v 1.206 2008/12/30 13:34:46 vapier Exp $";
11const char * const argv0 = "scanelf"; 11const 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 == '+')
75static caddr_t ldcache = 0; 75static caddr_t ldcache = 0;
76static size_t ldcache_size = 0; 76static size_t ldcache_size = 0;
77static unsigned long setpax = 0UL; 77static unsigned long setpax = 0UL;
78 78
79static int has_objdump = 0; 79static int has_objdump = 0;
80
81static const char *getstr_perms(const char *fname)
82{
83 struct stat st;
84 static char buf[8];
85
86 if (stat(fname, &st) == -1)
87 return "";
88
89 snprintf(buf, sizeof(buf), "%o", st.st_mode);
90
91 return buf + 2;
92}
93 80
94/* find the path to a file by name */ 81/* find the path to a file by name */
95static char *which(const char *fname) 82static char *which(const char *fname)
96{ 83{
97 static char fullpath[BUFSIZ]; 84 static char fullpath[BUFSIZ];
1234 case 't': out = scanelf_file_textrel(elf, &found_textrel); break; 1221 case 't': out = scanelf_file_textrel(elf, &found_textrel); break;
1235 case 'T': out = scanelf_file_textrels(elf, &found_textrels, &found_textrel); break; 1222 case 'T': out = scanelf_file_textrels(elf, &found_textrels, &found_textrel); break;
1236 case 'r': scanelf_file_rpath(elf, &found_rpath, &out_buffer, &out_len); break; 1223 case 'r': scanelf_file_rpath(elf, &found_rpath, &out_buffer, &out_len); break;
1237 case 'M': out = get_elfeitype(EI_CLASS, elf->data[EI_CLASS]); break; 1224 case 'M': out = get_elfeitype(EI_CLASS, elf->data[EI_CLASS]); break;
1238 case 'D': out = get_endian(elf); break; 1225 case 'D': out = get_endian(elf); break;
1239 case 'O': out = getstr_perms(elf->filename); break; 1226 case 'O': out = strfileperms(elf->filename); break;
1240 case 'n': 1227 case 'n':
1241 case 'N': out = scanelf_file_needed_lib(elf, &found_needed, &found_lib, (out_format[i]=='N'), &out_buffer, &out_len); break; 1228 case 'N': out = scanelf_file_needed_lib(elf, &found_needed, &found_lib, (out_format[i]=='N'), &out_buffer, &out_len); break;
1242 case 'i': out = scanelf_file_interp(elf, &found_interp); break; 1229 case 'i': out = scanelf_file_interp(elf, &found_interp); break;
1243 case 'b': out = scanelf_file_bind(elf, &found_bind); break; 1230 case 'b': out = scanelf_file_bind(elf, &found_bind); break;
1244 case 'S': out = scanelf_file_soname(elf, &found_soname); break; 1231 case 'S': out = scanelf_file_soname(elf, &found_soname); break;

Legend:
Removed from v.1.205  
changed lines
  Added in v.1.206

  ViewVC Help
Powered by ViewVC 1.1.20