Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/cron/dist simplify the bad extension code, by dsl.



details:   https://anonhg.NetBSD.org/src/rev/7a4e37491bd3
branches:  trunk
changeset: 770361:7a4e37491bd3
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 14 14:38:20 2011 +0000

description:
simplify the bad extension code, by dsl.

diffstat:

 external/bsd/cron/dist/database.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r cf1a020d3acc -r 7a4e37491bd3 external/bsd/cron/dist/database.c
--- a/external/bsd/cron/dist/database.c Fri Oct 14 13:12:41 2011 +0000
+++ b/external/bsd/cron/dist/database.c Fri Oct 14 14:38:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: database.c,v 1.6 2011/10/13 16:58:30 joerg Exp $       */
+/*     $NetBSD: database.c,v 1.7 2011/10/14 14:38:20 christos Exp $    */
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: database.c,v 1.7 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: database.c,v 1.6 2011/10/13 16:58:30 joerg Exp $");
+__RCSID("$NetBSD: database.c,v 1.7 2011/10/14 14:38:20 christos Exp $");
 #endif
 #endif
 
@@ -63,7 +63,7 @@
                 * Homage to...
                 */
                static const char *junk[] = {
-                       ".rpmsave", ".rpmorig", ".rpmnew",
+                       "rpmsave", "rpmorig", "rpmnew",
                };
 
                /* avoid file names beginning with ".".  this is good
@@ -93,11 +93,11 @@
 
                (void)strlcpy(fname, dp->d_name, sizeof(fname));
                
-               /* ... or look leftover crap */
+               /* ... or look for blacklisted extensions */
                for (i = 0; i < __arraycount(junk); i++) {
                        char *p;
-                       if ((p = strstr(fname, junk[i])) != NULL &&
-                           p[strlen(junk[i]) - 1] == '\0')
+                       if ((p = strrchr(fname, '.')) != NULL &&
+                           strcmp(p + 1, junk[i]) == 0)
                                break;
                }
                if (i != __arraycount(junk))



Home | Main Index | Thread Index | Old Index