/[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.89 Revision 1.90
1/* 1/*
2 * Copyright 2003-2005 Gentoo Foundation 2 * Copyright 2003-2005 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.89 2005/10/13 01:53:55 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.90 2005/12/04 18:12:44 vapier Exp $
5 * 5 *
6 * Copyright 2003-2005 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2005 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2005 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2005 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
20#include <dirent.h> 20#include <dirent.h>
21#include <getopt.h> 21#include <getopt.h>
22#include <assert.h> 22#include <assert.h>
23#include "paxinc.h" 23#include "paxinc.h"
24 24
25static const char *rcsid = "$Id: scanelf.c,v 1.89 2005/10/13 01:53:55 vapier Exp $"; 25static const char *rcsid = "$Id: scanelf.c,v 1.90 2005/12/04 18:12:44 vapier Exp $";
26#define argv0 "scanelf" 26#define argv0 "scanelf"
27 27
28#define IS_MODIFIER(c) (c == '%' || c == '#') 28#define IS_MODIFIER(c) (c == '%' || c == '#')
29 29
30 30
95 GET_SYMTABS(32) 95 GET_SYMTABS(32)
96 GET_SYMTABS(64) 96 GET_SYMTABS(64)
97} 97}
98static char *scanelf_file_pax(elfobj *elf, char *found_pax) 98static char *scanelf_file_pax(elfobj *elf, char *found_pax)
99{ 99{
100 static char *paxflags;
101 static char ret[7]; 100 static char ret[7];
102 unsigned long i, shown; 101 unsigned long i, shown;
103 102
104 if (!show_pax) return NULL; 103 if (!show_pax) return NULL;
105 104
126 SHOW_PAX(64) 125 SHOW_PAX(64)
127 } 126 }
128 127
129 /* fall back to EI_PAX if no PT_PAX was found */ 128 /* fall back to EI_PAX if no PT_PAX was found */
130 if (!*ret) { 129 if (!*ret) {
130 static char *paxflags;
131 paxflags = pax_short_hf_flags(EI_PAX_FLAGS(elf)); 131 paxflags = pax_short_hf_flags(EI_PAX_FLAGS(elf));
132 if (!be_quiet || (be_quiet && EI_PAX_FLAGS(elf))) { 132 if (!be_quiet || (be_quiet && EI_PAX_FLAGS(elf))) {
133 *found_pax = 1; 133 *found_pax = 1;
134 return paxflags; 134 return (be_wewy_wewy_quiet ? NULL : paxflags);
135 } 135 }
136 strncpy(ret, paxflags, sizeof(ret)); 136 strncpy(ret, paxflags, sizeof(ret));
137 } 137 }
138 138
139 if (be_quiet && !shown) 139 if (be_wewy_wewy_quiet || (be_quiet && !shown))
140 return NULL; 140 return NULL;
141 else
141 return ret; 142 return ret;
142
143} 143}
144
144static char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_relro, char *found_load) 145static char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_relro, char *found_load)
145{ 146{
146 static char ret[12]; 147 static char ret[12];
147 char *found; 148 char *found;
148 unsigned long i, off, shown, check_flags; 149 unsigned long i, off, shown, check_flags;
189 } 190 }
190 SHOW_PHDR(32) 191 SHOW_PHDR(32)
191 SHOW_PHDR(64) 192 SHOW_PHDR(64)
192 } 193 }
193 194
194 if (be_quiet && !shown) 195 if (be_wewy_wewy_quiet || (be_quiet && !shown))
195 return NULL; 196 return NULL;
196 else 197 else
197 return ret; 198 return ret;
198} 199}
199static char *scanelf_file_textrel(elfobj *elf, char *found_textrel) 200static const char *scanelf_file_textrel(elfobj *elf, char *found_textrel)
200{ 201{
201 static char ret[] = "TEXTREL"; 202 static const char *ret = "TEXTREL";
202 unsigned long i; 203 unsigned long i;
203 204
204 if (!show_textrel && !show_textrels) return NULL; 205 if (!show_textrel && !show_textrels) return NULL;
205 206
206 if (elf->phdr) { 207 if (elf->phdr) {
229 } 230 }
230 231
231 if (be_quiet || be_wewy_wewy_quiet) 232 if (be_quiet || be_wewy_wewy_quiet)
232 return NULL; 233 return NULL;
233 else 234 else
234 return (char *)" - "; 235 return " - ";
235} 236}
236static char *scanelf_file_textrels(elfobj *elf, char *found_textrels, char *found_textrel) 237static char *scanelf_file_textrels(elfobj *elf, char *found_textrels, char *found_textrel)
237{ 238{
238 unsigned long s, r, rmax; 239 unsigned long s, r, rmax;
239 void *symtab_void, *strtab_void, *text_void; 240 void *symtab_void, *strtab_void, *text_void;

Legend:
Removed from v.1.89  
changed lines
  Added in v.1.90

  ViewVC Help
Powered by ViewVC 1.1.20