/[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.171 Revision 1.172
1/* 1/*
2 * Copyright 2003-2006 Gentoo Foundation 2 * Copyright 2003-2006 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.171 2007/01/09 23:01:09 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.172 2007/01/09 23:04:12 vapier Exp $
5 * 5 *
6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10#include "paxinc.h" 10#include "paxinc.h"
11 11
12static const char *rcsid = "$Id: scanelf.c,v 1.171 2007/01/09 23:01:09 vapier Exp $"; 12static const char *rcsid = "$Id: scanelf.c,v 1.172 2007/01/09 23:04:12 vapier Exp $";
13#define argv0 "scanelf" 13#define argv0 "scanelf"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
16 16
17/* prototypes */ 17/* prototypes */
78int has_objdump = 0; 78int has_objdump = 0;
79 79
80static char *which(const char *fname) 80static char *which(const char *fname)
81{ 81{
82 static char fullpath[BUFSIZ]; 82 static char fullpath[BUFSIZ];
83 char *path, *p; 83 char *path, *p;
84 84
85 memset(fullpath, 0x0, sizeof(fullpath));
86
87 path = getenv("PATH"); 85 path = getenv("PATH");
88 86 if (!path)
89 if (!path)
90 return NULL; 87 return NULL;
91 88
92 path = xstrdup(path); 89 path = xstrdup(path);
93 while ((p = strrchr(path, ':')) != NULL) { 90 while ((p = strrchr(path, ':')) != NULL) {
94 snprintf(fullpath, sizeof(fullpath), "%s/%s", p + 1, fname); 91 snprintf(fullpath, sizeof(fullpath), "%s/%s", p + 1, fname);
95 *p = 0; 92 *p = 0;
96 if (access(fullpath, R_OK) != (-1)) { 93 if (access(fullpath, R_OK) != (-1)) {
97 free(path); 94 free(path);
98 return (char *) fullpath; 95 return (char *) fullpath;
99 } 96 }
100 } 97 }
101 free(path); 98 free(path);
102 return NULL; 99 return NULL;
103} 100}
104 101
105/* sub-funcs for scanelf_file() */ 102/* sub-funcs for scanelf_file() */
106static void scanelf_file_get_symtabs(elfobj *elf, void **sym, void **tab) 103static void scanelf_file_get_symtabs(elfobj *elf, void **sym, void **tab)

Legend:
Removed from v.1.171  
changed lines
  Added in v.1.172

  ViewVC Help
Powered by ViewVC 1.1.20