Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-projects commit in pax-utils: scanelf.c
Date: Sun, 04 Nov 2012 06:55:21
Message-Id: 20121104065504.53BBA215F3@flycatcher.gentoo.org
1 vapier 12/11/04 06:55:04
2
3 Modified: scanelf.c
4 Log:
5 scanelf: if people use -g twice, switch to case insensitive regexes #433425
6
7 Revision Changes Path
8 1.246 pax-utils/scanelf.c
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/scanelf.c?rev=1.246&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/scanelf.c?rev=1.246&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/scanelf.c?r1=1.245&r2=1.246
13
14 Index: scanelf.c
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v
17 retrieving revision 1.245
18 retrieving revision 1.246
19 diff -u -r1.245 -r1.246
20 --- scanelf.c 4 Aug 2012 06:08:25 -0000 1.245
21 +++ scanelf.c 4 Nov 2012 06:55:04 -0000 1.246
22 @@ -1,13 +1,13 @@
23 /*
24 * Copyright 2003-2007 Gentoo Foundation
25 * Distributed under the terms of the GNU General Public License v2
26 - * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.245 2012/08/04 06:08:25 vapier Exp $
27 + * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.246 2012/11/04 06:55:04 vapier Exp $
28 *
29 * Copyright 2003-2007 Ned Ludd - <solar@g.o>
30 * Copyright 2004-2007 Mike Frysinger - <vapier@g.o>
31 */
32
33 -static const char rcsid[] = "$Id: scanelf.c,v 1.245 2012/08/04 06:08:25 vapier Exp $";
34 +static const char rcsid[] = "$Id: scanelf.c,v 1.246 2012/11/04 06:55:04 vapier Exp $";
35 const char argv0[] = "scanelf";
36
37 #include "paxinc.h"
38 @@ -127,14 +127,11 @@
39 if ((match == NULL) || (regex == NULL))
40 return EXIT_FAILURE;
41
42 - if ((ret = regcomp(&preg, regex, cflags))) {
43 + ret = regcomp(&preg, regex, cflags);
44 + if (ret) {
45 char err[256];
46 -
47 - if (regerror(ret, &preg, err, sizeof(err)))
48 - fprintf(stderr, "regcomp failed: %s", err);
49 - else
50 - fprintf(stderr, "regcomp failed");
51 -
52 + regerror(ret, &preg, err, sizeof(err));
53 + warnf("regcomp failed: %s", err);
54 return EXIT_FAILURE;
55 }
56 ret = regexec(&preg, match, 0, NULL, 0);
57 @@ -1272,7 +1269,10 @@
58 } else {
59 if (g_match) {
60 /* regex match the symbol */
61 - if (rematch(this_sym, symname, REG_EXTENDED) != 0)
62 + int flags = REG_EXTENDED | REG_NOSUB;
63 + if (g_match > 1)
64 + flags |= REG_ICASE;
65 + if (rematch(this_sym, symname, flags) != 0)
66 continue;
67
68 } else if (*this_sym) {
69 @@ -2026,7 +2026,7 @@
70 "Find a specified symbol",
71 "Find a specified section",
72 "Find a specified library",
73 - "Use regex matching rather than string compare (use with -s)",
74 + "Use regex rather than string compare (with -s); specify twice for case insensitive",
75 "Locate cause of TEXTREL",
76 "Print only ELF files matching etype ET_DYN,ET_EXEC ...",
77 "Print only ELF files matching numeric bits",
78 @@ -2188,7 +2188,7 @@
79 break;
80 }
81 case 'Z': show_size = 1; break;
82 - case 'g': g_match = 1; break;
83 + case 'g': ++g_match; break;
84 case 'L': load_cache_config = use_ldcache = 1; break;
85 case 'y': scan_symlink = 0; break;
86 case 'A': scan_archives = 1; break;