/[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.188 Revision 1.189
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.188 2007/08/31 17:45:24 solar Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.189 2008/01/17 04:37:19 solar 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.188 2007/08/31 17:45:24 solar Exp $"; 10static const char *rcsid = "$Id: scanelf.c,v 1.189 2008/01/17 04:37:19 solar 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 == '+')
119 int ret; 119 int ret;
120 120
121 if ((match == NULL) || (regex == NULL)) 121 if ((match == NULL) || (regex == NULL))
122 return EXIT_FAILURE; 122 return EXIT_FAILURE;
123 123
124
125 if ((ret = regcomp(&preg, regex, cflags))) { 124 if ((ret = regcomp(&preg, regex, cflags))) {
126 char err[256]; 125 char err[256];
127 126
128 if (regerror(ret, &preg, err, sizeof(err))) 127 if (regerror(ret, &preg, err, sizeof(err)))
129 fprintf(stderr, "regcomp failed: %s", err); 128 fprintf(stderr, "regcomp failed: %s", err);
197 } \ 196 } \
198 } 197 }
199 SHOW_PAX(32) 198 SHOW_PAX(32)
200 SHOW_PAX(64) 199 SHOW_PAX(64)
201 } 200 }
202
203 201
204 if (fix_elf && setpax) { 202 if (fix_elf && setpax) {
205 /* set the chpax settings */ 203 /* set the chpax settings */
206 if (elf->elf_class == ELFCLASS32) { 204 if (elf->elf_class == ELFCLASS32) {
207 if (EHDR32(elf->ehdr)->e_type == ET_DYN || EHDR32(elf->ehdr)->e_type == ET_EXEC) 205 if (EHDR32(elf->ehdr)->e_type == ET_DYN || EHDR32(elf->ehdr)->e_type == ET_EXEC)
1067 return NULL; 1065 return NULL;
1068 else 1066 else
1069 return (char *)" - "; 1067 return (char *)" - ";
1070} 1068}
1071 1069
1072
1073static char *scanelf_file_sections(elfobj *elf, char *found_section) 1070static char *scanelf_file_sections(elfobj *elf, char *found_section)
1074{ 1071{
1075 if (!find_section) 1072 if (!find_section)
1076 return NULL; 1073 return NULL;
1077 1074
1588 *p = 0; 1585 *p = 0;
1589 } 1586 }
1590 1587
1591 free(path); 1588 free(path);
1592} 1589}
1593
1594 1590
1595/* usage / invocation handling functions */ /* Free Flags: c d j u w C G H I J K P Q U W Y Z */ 1591/* usage / invocation handling functions */ /* Free Flags: c d j u w C G H I J K P Q U W Y Z */
1596#define PARSE_FLAGS "plRmyAXz:xetrnLibSs:k:gN:TaqvF:f:o:E:M:DO:BhV" 1592#define PARSE_FLAGS "plRmyAXz:xetrnLibSs:k:gN:TaqvF:f:o:E:M:DO:BhV"
1597#define a_argument required_argument 1593#define a_argument required_argument
1598static struct option const long_opts[] = { 1594static struct option const long_opts[] = {
1981 free(qa_execstack); 1977 free(qa_execstack);
1982 free(qa_wx_load); 1978 free(qa_wx_load);
1983} 1979}
1984#endif 1980#endif
1985 1981
1986
1987int main(int argc, char *argv[]) 1982int main(int argc, char *argv[])
1988{ 1983{
1989 int ret; 1984 int ret;
1990 if (argc < 2) 1985 if (argc < 2)
1991 usage(EXIT_FAILURE); 1986 usage(EXIT_FAILURE);
1999 "\t- 1 per QA_TEXTRELS/QA_EXECSTACK/QA_WX_LOAD"); 1994 "\t- 1 per QA_TEXTRELS/QA_EXECSTACK/QA_WX_LOAD");
2000#endif 1995#endif
2001 return ret; 1996 return ret;
2002} 1997}
2003 1998
2004
2005/* Match filename against entries in matchlist, return TRUE 1999/* Match filename against entries in matchlist, return TRUE
2006 * if the file is listed */ 2000 * if the file is listed */
2007static int file_matches_list(const char *filename, char **matchlist) 2001static int file_matches_list(const char *filename, char **matchlist)
2008{ 2002{
2009 char **file; 2003 char **file;

Legend:
Removed from v.1.188  
changed lines
  Added in v.1.189

  ViewVC Help
Powered by ViewVC 1.1.20