/[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.30 Revision 1.31
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.30 2005/04/05 16:15:31 solar Exp $ 5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.31 2005/04/06 02:01:52 solar 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
33#include <getopt.h> 33#include <getopt.h>
34#include <assert.h> 34#include <assert.h>
35 35
36#include "paxelf.h" 36#include "paxelf.h"
37 37
38static const char *rcsid = "$Id: scanelf.c,v 1.30 2005/04/05 16:15:31 solar Exp $"; 38static const char *rcsid = "$Id: scanelf.c,v 1.31 2005/04/06 02:01:52 solar Exp $";
39 39
40 40
41/* helper functions for showing errors */ 41/* helper functions for showing errors */
42#define argv0 "scanelf" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/ 42#define argv0 "scanelf" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/
43#define warn(fmt, args...) \ 43#define warn(fmt, args...) \
290 290
291 while ((dentry = readdir(dir))) { 291 while ((dentry = readdir(dir))) {
292 if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, "..")) 292 if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, ".."))
293 continue; 293 continue;
294 len = (strlen(path) + 2 + strlen(dentry->d_name)); 294 len = (strlen(path) + 2 + strlen(dentry->d_name));
295 if (len >= sizeof(buf)) warn("len > sizeof(buf); %d %d = %s\n", len, sizeof(buf), path);
295 assert(len < sizeof(buf)); 296 assert(len < sizeof(buf));
296 strncpy(buf, path, len); 297 sprintf(buf, "%s/%s", path, dentry->d_name);
297 strncat(buf, "/", len);
298 strncat(buf, dentry->d_name, len);
299 buf[sizeof(buf)] = 0;
300 if (lstat(buf, &st) != -1) { 298 if (lstat(buf, &st) != -1) {
301 if (S_ISREG(st.st_mode)) 299 if (S_ISREG(st.st_mode))
302 scanelf_file(buf); 300 scanelf_file(buf);
303 else if (dir_recurse && S_ISDIR(st.st_mode)) { 301 else if (dir_recurse && S_ISDIR(st.st_mode)) {
304 if (dir_crossmount || (st_top.st_dev == st.st_dev)) 302 if (dir_crossmount || (st_top.st_dev == st.st_dev))

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20