/[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.67 Revision 1.68
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.67 2005/06/03 02:56:18 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.68 2005/06/03 15:03:25 solar Exp $
5 * 5 *
6 ******************************************************************** 6 ********************************************************************
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the 9 * published by the Free Software Foundation; either version 2 of the
33#include <dirent.h> 33#include <dirent.h>
34#include <getopt.h> 34#include <getopt.h>
35#include <assert.h> 35#include <assert.h>
36#include "paxelf.h" 36#include "paxelf.h"
37 37
38static const char *rcsid = "$Id: scanelf.c,v 1.67 2005/06/03 02:56:18 vapier Exp $"; 38static const char *rcsid = "$Id: scanelf.c,v 1.68 2005/06/03 15:03:25 solar Exp $";
39#define argv0 "scanelf" 39#define argv0 "scanelf"
40 40
41 41
42 42
43/* prototypes */ 43/* prototypes */
163 else 163 else
164 return ret; 164 return ret;
165} 165}
166static char *scanelf_file_textrel(elfobj *elf, char *found_textrel) 166static char *scanelf_file_textrel(elfobj *elf, char *found_textrel)
167{ 167{
168 static char *ret = "TEXTREL"; 168 static char ret[] = "TEXTREL";
169 unsigned long i; 169 unsigned long i;
170 170
171 if (!show_textrel) return NULL; 171 if (!show_textrel) return NULL;
172 172
173 if (elf->phdr) { 173 if (elf->phdr) {
196 } 196 }
197 197
198 if (be_quiet) 198 if (be_quiet)
199 return NULL; 199 return NULL;
200 else 200 else
201 return " - "; 201 return (char *)" - ";
202} 202}
203static void scanelf_file_rpath(elfobj *elf, char *found_rpath, char **ret, size_t *ret_len) 203static void scanelf_file_rpath(elfobj *elf, char *found_rpath, char **ret, size_t *ret_len)
204{ 204{
205 /* TODO: when checking RPATH entries, check each subpath (between :) in ld.so.conf */ 205 /* TODO: when checking RPATH entries, check each subpath (between :) in ld.so.conf */
206 unsigned long i, s; 206 unsigned long i, s;
360 if (EGET(dyn->d_tag) == DT_BIND_NOW || \ 360 if (EGET(dyn->d_tag) == DT_BIND_NOW || \
361 (EGET(dyn->d_tag) == DT_FLAGS && EGET(dyn->d_un.d_val) & DF_BIND_NOW)) \ 361 (EGET(dyn->d_tag) == DT_FLAGS && EGET(dyn->d_un.d_val) & DF_BIND_NOW)) \
362 { \ 362 { \
363 if (be_quiet) return NULL; \ 363 if (be_quiet) return NULL; \
364 *found_bind = 1; \ 364 *found_bind = 1; \
365 return "NOW"; \ 365 return (char *) "NOW"; \
366 } \ 366 } \
367 ++dyn; \ 367 ++dyn; \
368 } \ 368 } \
369 } \ 369 } \
370 } 370 }
373 373
374 if (be_quiet && !fstat(elf->fd, &s) && !(s.st_mode & S_ISUID || s.st_mode & S_ISGID)) { 374 if (be_quiet && !fstat(elf->fd, &s) && !(s.st_mode & S_ISUID || s.st_mode & S_ISGID)) {
375 return NULL; 375 return NULL;
376 } else { 376 } else {
377 *found_bind = 1; 377 *found_bind = 1;
378 return "LAZY"; 378 return (char *) "LAZY";
379 } 379 }
380} 380}
381static char *scanelf_file_sym(elfobj *elf, char *found_sym, const char *filename) 381static char *scanelf_file_sym(elfobj *elf, char *found_sym, const char *filename)
382{ 382{
383 unsigned long i; 383 unsigned long i;
429 if (*find_sym != '*' && *found_sym) 429 if (*find_sym != '*' && *found_sym)
430 return find_sym; 430 return find_sym;
431 if (be_quiet) 431 if (be_quiet)
432 return NULL; 432 return NULL;
433 else 433 else
434 return " - "; 434 return (char *)" - ";
435} 435}
436/* scan an elf file and show all the fun stuff */ 436/* scan an elf file and show all the fun stuff */
437// #define prints(str) fputs(str, stdout) 437// #define prints(str) fputs(str, stdout)
438#define prints(str) write(fileno(stdout), str, strlen(str)) 438#define prints(str) write(fileno(stdout), str, strlen(str))
439static void scanelf_file(const char *filename) 439static void scanelf_file(const char *filename)
749 {"help", no_argument, NULL, 'h'}, 749 {"help", no_argument, NULL, 'h'},
750 {"version", no_argument, NULL, 'V'}, 750 {"version", no_argument, NULL, 'V'},
751 {NULL, no_argument, NULL, 0x0} 751 {NULL, no_argument, NULL, 0x0}
752}; 752};
753 753
754static char *opts_help[] = { 754static const char *opts_help[] = {
755 "Scan all directories in PATH environment", 755 "Scan all directories in PATH environment",
756 "Scan all directories in /etc/ld.so.conf", 756 "Scan all directories in /etc/ld.so.conf",
757 "Scan directories recursively", 757 "Scan directories recursively",
758 "Don't recursively cross mount points", 758 "Don't recursively cross mount points",
759 "Don't scan symlinks\n", 759 "Don't scan symlinks\n",

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

  ViewVC Help
Powered by ViewVC 1.1.20