/[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.14 Revision 1.15
1/* 1/*
2 * Copyright 2003 Ned Ludd <solar@gentoo.org> 2 * Copyright 2003 Ned Ludd <solar@gentoo.org>
3 * Copyright 1999-2005 Gentoo Foundation 3 * Copyright 1999-2005 Gentoo Foundation
4 * Distributed under the terms of the GNU General Public License v2 4 * Distributed under the terms of the GNU General Public License v2
5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.14 2005/04/01 19:56:34 vapier Exp $ 5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.15 2005/04/01 20:08:44 vapier Exp $
6 * 6 *
7 ******************************************************************** 7 ********************************************************************
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the 10 * published by the Free Software Foundation; either version 2 of the
31#include <dirent.h> 31#include <dirent.h>
32#include <getopt.h> 32#include <getopt.h>
33 33
34#include "paxelf.h" 34#include "paxelf.h"
35 35
36static const char *rcsid = "$Id: scanelf.c,v 1.14 2005/04/01 19:56:34 vapier Exp $"; 36static const char *rcsid = "$Id: scanelf.c,v 1.15 2005/04/01 20:08:44 vapier Exp $";
37 37
38 38
39/* helper functions for showing errors */ 39/* helper functions for showing errors */
40#define argv0 "scanelf\0" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/ 40#define argv0 "scanelf\0" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/
41#define warn(fmt, args...) \ 41#define warn(fmt, args...) \
82 82
83 found_pax = found_stack = found_relro = found_textrel = found_rpath = 0; 83 found_pax = found_stack = found_relro = found_textrel = found_rpath = 0;
84 84
85 /* verify this is real ELF */ 85 /* verify this is real ELF */
86 if ((elf = readelf(filename)) == NULL) { 86 if ((elf = readelf(filename)) == NULL) {
87 if (be_verbose > 1) printf("File '%s' is not an ELF\n", filename); 87 if (be_verbose > 1) printf("%s: not an ELF\n", filename);
88 return; 88 return;
89 } 89 }
90 if (check_elf_header(elf->ehdr) || !IS_ELF(elf)) { 90 if (check_elf_header(elf->ehdr) || !IS_ELF(elf)) {
91 if (be_verbose > 1) printf("Cannot handle ELF '%s' :(\n", filename); 91 if (be_verbose > 1) printf("%s: cannot handle ELF :(\n", filename);
92 goto bail; 92 goto bail;
93 } 93 }
94 94
95 if (be_verbose) printf("Scanning file %s\n", filename); 95 if (be_verbose) printf("%s: scanning file\n", filename);
96 96
97 /* show the header */ 97 /* show the header */
98 if (!be_quiet && show_header) { 98 if (!be_quiet && show_header) {
99 fputs(" TYPE ", stdout); 99 fputs(" TYPE ", stdout);
100 if (show_pax) fputs(" PAX ", stdout); 100 if (show_pax) fputs(" PAX ", stdout);
206 /* now scan the dir looking for fun stuff */ 206 /* now scan the dir looking for fun stuff */
207 if ((dir = opendir(path)) == NULL) { 207 if ((dir = opendir(path)) == NULL) {
208 warnf("could not opendir %s: %s", path, strerror(errno)); 208 warnf("could not opendir %s: %s", path, strerror(errno));
209 return; 209 return;
210 } 210 }
211 if (be_verbose) printf("Scanning dir %s\n", path); 211 if (be_verbose) printf("%s: scanning dir\n", path);
212 212
213 while ((dentry = readdir(dir))) { 213 while ((dentry = readdir(dir))) {
214 if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, "..")) 214 if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, ".."))
215 continue; 215 continue;
216 len = (strlen(path) + 2 + strlen(dentry->d_name)); 216 len = (strlen(path) + 2 + strlen(dentry->d_name));

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20