]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8818 #resolve refactor X-PRE include to not toss error if there are not files...
authorKen Rice <krice@freeswitch.org>
Tue, 9 Feb 2016 22:38:47 +0000 (16:38 -0600)
committerBrian West <brian@freeswitch.org>
Tue, 9 Feb 2016 22:38:47 +0000 (16:38 -0600)
src/switch_xml.c

index 5faf4b235f5d8b9eac6f159006f7d01622ce3e66..ffcdd8b15f0a51f9a4904a14d22601f76c438c22 100644 (file)
@@ -1298,15 +1298,20 @@ static FILE *preprocess_glob(const char *cwd, const char *pattern, FILE *write_f
        char *dir_path = NULL, *e = NULL;
        glob_t glob_data;
        size_t n;
+       int glob_return;
 
        if (!switch_is_file_path(pattern)) {
                full_path = switch_mprintf("%s%s%s", cwd, SWITCH_PATH_SEPARATOR, pattern);
                pattern = full_path;
        }
 
-       if (glob(pattern, GLOB_NOCHECK, NULL, &glob_data) != 0) {
+       glob_return = glob(pattern, GLOB_ERR, NULL, &glob_data);
+       if (glob_return == GLOB_NOSPACE || glob_return == GLOB_ABORTED) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s\n", pattern);
                goto end;
+       } else if (glob_return == GLOB_NOMATCH) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No files to include at %s\n", pattern);
+               goto end;
        }
 
        for (n = 0; n < glob_data.gl_pathc; ++n) {
@@ -1324,7 +1329,7 @@ static FILE *preprocess_glob(const char *cwd, const char *pattern, FILE *write_f
        }
        globfree(&glob_data);
 
 end:
+ end:
 
        switch_safe_free(full_path);