/[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.148 Revision 1.149
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.148 2006/05/14 21:18:38 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.149 2006/05/14 21:21:35 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.148 2006/05/14 21:18:38 vapier Exp $"; 12static const char *rcsid = "$Id: scanelf.c,v 1.149 2006/05/14 21:21:35 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#define do_state(option, flag) \ 17#define do_state(option, flag) \
1373{ 1373{
1374 FILE *fp = NULL; 1374 FILE *fp = NULL;
1375 char *p; 1375 char *p;
1376 char path[__PAX_UTILS_PATH_MAX]; 1376 char path[__PAX_UTILS_PATH_MAX];
1377 1377
1378 if (i + 1 == sizeof(ldpaths) / sizeof(*ldpaths)) 1378 if (i + 1 == ARRAY_SIZE(ldpaths))
1379 return i; 1379 return i;
1380 1380
1381 if ((fp = fopen(fname, "r")) == NULL) 1381 if ((fp = fopen(fname, "r")) == NULL)
1382 return i; 1382 return i;
1383 1383
1403 for (x = 0; x < gl.gl_pathc; ++x) { 1403 for (x = 0; x < gl.gl_pathc; ++x) {
1404 /* try to avoid direct loops */ 1404 /* try to avoid direct loops */
1405 if (strcmp(gl.gl_pathv[x], fname) == 0) 1405 if (strcmp(gl.gl_pathv[x], fname) == 0)
1406 continue; 1406 continue;
1407 i = load_ld_cache_config(i, gl.gl_pathv[x]); 1407 i = load_ld_cache_config(i, gl.gl_pathv[x]);
1408 if (i + 1 >= sizeof(ldpaths) / sizeof(*ldpaths)) { 1408 if (i + 1 >= ARRAY_SIZE(ldpaths)) {
1409 globfree64(&gl); 1409 globfree64(&gl);
1410 return i; 1410 return i;
1411 } 1411 }
1412 } 1412 }
1413 globfree64 (&gl); 1413 globfree64 (&gl);
1418 if (*path != '/') 1418 if (*path != '/')
1419 continue; 1419 continue;
1420 1420
1421 ldpaths[i++] = xstrdup(path); 1421 ldpaths[i++] = xstrdup(path);
1422 1422
1423 if (i + 1 == sizeof(ldpaths) / sizeof(*ldpaths)) 1423 if (i + 1 == ARRAY_SIZE(ldpaths))
1424 break; 1424 break;
1425 } 1425 }
1426 ldpaths[i] = NULL; 1426 ldpaths[i] = NULL;
1427 1427
1428 fclose(fp); 1428 fclose(fp);
1435{ 1435{
1436 FILE *fp = NULL; 1436 FILE *fp = NULL;
1437 char *b = NULL, *p; 1437 char *b = NULL, *p;
1438 struct elfhints_hdr hdr; 1438 struct elfhints_hdr hdr;
1439 1439
1440 if (i + 1 == sizeof(ldpaths) / sizeof(*ldpaths)) 1440 if (i + 1 == ARRAY_SIZE(ldpaths))
1441 return i; 1441 return i;
1442 1442
1443 if ((fp = fopen(fname, "r")) == NULL) 1443 if ((fp = fopen(fname, "r")) == NULL)
1444 return i; 1444 return i;
1445 1445
1460 1460
1461 while ( (p = strsep(&b, ":")) ) { 1461 while ( (p = strsep(&b, ":")) ) {
1462 if ( *p == '\0' ) continue; 1462 if ( *p == '\0' ) continue;
1463 ldpaths[i++] = xstrdup(p); 1463 ldpaths[i++] = xstrdup(p);
1464 1464
1465 if (i + 1 == sizeof(ldpaths) / sizeof(*ldpaths)) 1465 if (i + 1 == ARRAY_SIZE(ldpaths))
1466 break; 1466 break;
1467 } 1467 }
1468 ldpaths[i] = NULL; 1468 ldpaths[i] = NULL;
1469 1469
1470 free(b); 1470 free(b);

Legend:
Removed from v.1.148  
changed lines
  Added in v.1.149

  ViewVC Help
Powered by ViewVC 1.1.20