diff --git a/src/config.cpp b/src/config.cpp index 0eea60a1c..289dd8a1e 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -39,6 +39,9 @@ #ifdef __linux__ #include #endif +#if defined(__linux__) || defined(__APPLE__) +#include +#endif const char *KEYDB_SET_VERSION = KEYDB_REAL_VERSION; size_t g_semiOrderedSetTargetBucketSize = 0; // Its a header only class so nowhere else for this to go @@ -593,7 +596,22 @@ void loadServerConfigFromString(char *config) { fclose(logfp); } } else if (!strcasecmp(argv[0],"include") && argc == 2) { - loadServerConfig(argv[1], 0, NULL); + glob_t globbuf; + int ret; + ret = glob(argv[1], GLOB_ERR, NULL, &globbuf); + if (ret != EXIT_SUCCESS && ret != GLOB_NOMATCH) { + strerror(errno); + err = sdscatprintf(sdsempty(), + "Error handling include directive: %s", strerror(errno)); + globfree(&globbuf); + goto loaderr; + } + + for (size_t i = 0; i < globbuf.gl_pathc; i++) { + loadServerConfig(globbuf.gl_pathv[i], 0, NULL); + } + + globfree(&globbuf); } else if ((!strcasecmp(argv[0],"slaveof") || !strcasecmp(argv[0],"replicaof")) && argc == 3) { slaveof_linenum = linenum;