提交 5098f7a1 authored 作者: Anthony Minessale's avatar Anthony Minessale

fix file_path issues

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6546 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 3e439b24
...@@ -38,7 +38,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa ...@@ -38,7 +38,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa
char *path = NULL; char *path = NULL;
char path_buf[1024]; char path_buf[1024];
if (file_path[0] == '/') { if (switch_is_file_path(file_path)) {
path = file_path; path = file_path;
} else { } else {
snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path); snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path);
...@@ -53,7 +53,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa ...@@ -53,7 +53,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa
cfg->lockto = -1; cfg->lockto = -1;
if (!(f = fopen(path, "r"))) { if (!(f = fopen(path, "r"))) {
if (file_path[0] != '/') { if (!switch_is_file_path(file_path)) {
int last = -1; int last = -1;
char *var, *val; char *var, *val;
......
...@@ -88,7 +88,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t ...@@ -88,7 +88,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t
assert(ah != NULL); assert(ah != NULL);
if (*path != '/') { if (!switch_is_file_path(path)) {
epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path); epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path);
path = epath; path = epath;
} }
......
...@@ -39,7 +39,7 @@ static void db_pick_path(char *dbname, char *buf, switch_size_t size) ...@@ -39,7 +39,7 @@ static void db_pick_path(char *dbname, char *buf, switch_size_t size)
{ {
memset(buf, 0, size); memset(buf, 0, size);
if (strchr(dbname, '/')) { if (switch_is_file_path(dbname)) {
strncpy(buf, dbname, size); strncpy(buf, dbname, size);
} else { } else {
snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname); snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname);
......
...@@ -635,10 +635,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -635,10 +635,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_buffer_create_dynamic(&ringback.audio_buffer, 512, 1024, 0); switch_buffer_create_dynamic(&ringback.audio_buffer, 512, 1024, 0);
switch_buffer_set_loops(ringback.audio_buffer, -1); switch_buffer_set_loops(ringback.audio_buffer, -1);
if (*ringback_data == '/') { if (switch_is_file_path(ringback_data)) {
char *ext; char *ext;
if ((ext = strrchr(ringback_data, '.'))) { if ((ext = strrchr(ringback_data, '.'))) {
switch_core_session_set_read_codec(session, &write_codec); switch_core_session_set_read_codec(session, &write_codec);
ext++; ext++;
......
...@@ -770,7 +770,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch ...@@ -770,7 +770,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
if (*file == '/') { if (switch_is_file_path(file)) {
path = switch_core_strdup(loadable_modules.pool, file); path = switch_core_strdup(loadable_modules.pool, file);
file = (char *)switch_cut_path(file); file = (char *)switch_cut_path(file);
if ((dot = strchr(file, '.'))) { if ((dot = strchr(file, '.'))) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论