unify some common code
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
94b0c2220a
commit
0b7e752709
|
@ -34,12 +34,25 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
#include "asterisk/network.h" /* we do some sockaddr manipulation here */
|
#include "asterisk/network.h" /* we do some sockaddr manipulation here */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define AST_INCLUDE_GLOB 1
|
#define AST_INCLUDE_GLOB 1
|
||||||
|
|
||||||
#ifdef AST_INCLUDE_GLOB
|
#ifdef AST_INCLUDE_GLOB
|
||||||
|
/* glob compat stuff - eventually this should go in compat.h or some
|
||||||
|
* header in include/asterisk/
|
||||||
|
*/
|
||||||
#if defined(__Darwin__) || defined(__CYGWIN__)
|
#if defined(__Darwin__) || defined(__CYGWIN__)
|
||||||
#define GLOB_ABORTED GLOB_ABEND
|
#define GLOB_ABORTED GLOB_ABEND
|
||||||
#endif
|
#endif
|
||||||
# include <glob.h>
|
|
||||||
|
#include <glob.h>
|
||||||
|
|
||||||
|
#ifdef SOLARIS
|
||||||
|
#define MY_GLOB_FLAGS GLOB_NOCHECK
|
||||||
|
#else
|
||||||
|
#define MY_GLOB_FLAGS (GLOB_NOMAGIC|GLOB_BRACE)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "asterisk/config.h"
|
#include "asterisk/config.h"
|
||||||
|
@ -1130,11 +1143,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
||||||
int glob_ret;
|
int glob_ret;
|
||||||
glob_t globbuf;
|
glob_t globbuf;
|
||||||
globbuf.gl_offs = 0; /* initialize it to silence gcc */
|
globbuf.gl_offs = 0; /* initialize it to silence gcc */
|
||||||
#ifdef SOLARIS
|
glob_ret = glob(fn, MY_GLOB_FLAGS, NULL, &globbuf);
|
||||||
glob_ret = glob(fn, GLOB_NOCHECK, NULL, &globbuf);
|
|
||||||
#else
|
|
||||||
glob_ret = glob(fn, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);
|
|
||||||
#endif
|
|
||||||
if (glob_ret == GLOB_NOSPACE)
|
if (glob_ret == GLOB_NOSPACE)
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Glob Expansion of pattern '%s' failed: Not enough memory\n", fn);
|
"Glob Expansion of pattern '%s' failed: Not enough memory\n", fn);
|
||||||
|
@ -1189,11 +1198,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
||||||
#ifdef AST_INCLUDE_GLOB
|
#ifdef AST_INCLUDE_GLOB
|
||||||
int glob_ret;
|
int glob_ret;
|
||||||
glob_t globbuf = { .gl_offs = 0 };
|
glob_t globbuf = { .gl_offs = 0 };
|
||||||
#ifdef SOLARIS
|
glob_ret = glob(cfinclude->include, MY_GLOB_FLAGS, NULL, &globbuf);
|
||||||
glob_ret = glob(cfinclude->include, GLOB_NOCHECK, NULL, &globbuf);
|
|
||||||
#else
|
|
||||||
glob_ret = glob(cfinclude->include, GLOB_NOMAGIC|GLOB_BRACE, NULL, &globbuf);
|
|
||||||
#endif
|
|
||||||
/* On error, we reparse */
|
/* On error, we reparse */
|
||||||
if (glob_ret == GLOB_NOSPACE || glob_ret == GLOB_ABORTED)
|
if (glob_ret == GLOB_NOSPACE || glob_ret == GLOB_ABORTED)
|
||||||
unchanged = 0;
|
unchanged = 0;
|
||||||
|
|
Loading…
Reference in New Issue