policycoreutils: setfiles: Fix process_glob to handle error situations properly

Rather than error when a glob does not match return success as this is
not a problem.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Dan Walsh 2011-08-23 14:46:37 -04:00 committed by Eric Paris
parent a0e2e16878
commit ddc5063c16

View File

@ -368,9 +368,12 @@ int process_glob(char *name, int recurse) {
int errors; int errors;
memset(&globbuf, 0, sizeof(globbuf)); memset(&globbuf, 0, sizeof(globbuf));
errors = glob(name, GLOB_TILDE | GLOB_PERIOD, NULL, &globbuf); errors = glob(name, GLOB_TILDE | GLOB_PERIOD, NULL, &globbuf);
if (errors == GLOB_NOMATCH)
return 0;
if (errors) if (errors)
errors = process_one_realpath(name, recurse); return errors;
else {
for (i = 0; i < globbuf.gl_pathc; i++) { for (i = 0; i < globbuf.gl_pathc; i++) {
int len = strlen(globbuf.gl_pathv[i]) -2; int len = strlen(globbuf.gl_pathv[i]) -2;
if (len > 0 && strcmp(&globbuf.gl_pathv[i][len--], "/.") == 0) if (len > 0 && strcmp(&globbuf.gl_pathv[i][len--], "/.") == 0)
@ -380,7 +383,6 @@ int process_glob(char *name, int recurse) {
errors |= process_one_realpath(globbuf.gl_pathv[i], recurse); errors |= process_one_realpath(globbuf.gl_pathv[i], recurse);
} }
globfree(&globbuf); globfree(&globbuf);
}
return errors; return errors;
} }