Changed the non-globbing version of glob_expand_one() so that it
authorWayne Davison <wayned@samba.org>
Sat, 8 May 2004 20:03:39 +0000 (20:03 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 8 May 2004 20:03:39 +0000 (20:03 +0000)
checks the maxargs argument instead of leaving it unused.

util.c

diff --git a/util.c b/util.c
index 9f28148..6fe19fc 100644 (file)
--- a/util.c
+++ b/util.c
@@ -499,7 +499,10 @@ static int exclude_server_path(char *arg)
 static void glob_expand_one(char *s, char **argv, int *argc, int maxargs)
 {
 #if !(defined(HAVE_GLOB) && defined(HAVE_GLOB_H))
-       if (!*s) s = ".";
+       if (maxargs <= *argc)
+               return;
+       if (!*s)
+               s = ".";
        s = argv[*argc] = strdup(s);
        exclude_server_path(s);
        (*argc)++;
@@ -508,12 +511,12 @@ static void glob_expand_one(char *s, char **argv, int *argc, int maxargs)
        glob_t globbuf;
        int i;
 
-       if (!*s) s = ".";
+       if (!*s)
+               s = ".";
 
        s = argv[*argc] = strdup(s);
-       if (sanitize_paths) {
+       if (sanitize_paths)
                sanitize_path(s, NULL);
-       }
 
        memset(&globbuf, 0, sizeof globbuf);
        if (!exclude_server_path(s))