]> granicus.if.org Git - sudo/commitdiff
Redo change in 1.34 to use pointer arithmetic.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 12 Sep 2008 13:34:27 +0000 (13:34 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 12 Sep 2008 13:34:27 +0000 (13:34 +0000)
match.c

diff --git a/match.c b/match.c
index 3aa153c62dac2d2afdfb8986f7c87f600ebdc800..e62513ac64660cb99b2b115038420be0fe43716e 100644 (file)
--- a/match.c
+++ b/match.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1998-2005, 2008
+ * Copyright (c) 1996, 1998-2005, 2007-2008
  *     Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -370,10 +370,9 @@ command_matches(sudoers_cmnd, sudoers_args)
 {
     struct stat sudoers_stat;
     struct dirent *dent;
-    char *cp, *base, buf[PATH_MAX];
+    char **ap, *base, buf[PATH_MAX], *cp;
     glob_t gl;
     DIR *dirp;
-    int i;
 
     /* Check for pseudo-commands */
     if (strchr(user_cmnd, '/') == NULL) {
@@ -415,8 +414,7 @@ command_matches(sudoers_cmnd, sudoers_args)
            return(FALSE);
        }
        /* For each glob match, compare basename, st_dev and st_ino. */
-       i = 0;
-       while ((cp = gl.gl_pathv[i++])) {
+       for (ap = gl.gl_pathv; (cp = *ap) != NULL; ap++) {
            /* only stat if basenames are the same */
            if ((base = strrchr(cp, '/')) != NULL)
                base++;