From d19d4b96abd381e033d5d6a9d9a7a556e0a6512b Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 13 Jun 2011 13:33:25 -0400 Subject: [PATCH] use -base directory as the cwd for the process --- src/include/switch_apr.h | 1 + src/switch.c | 2 ++ src/switch_apr.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 2306075e1f..9ec6f94496 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -854,6 +854,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm, switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_status_t) switch_filepath_set(const char *path, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset); diff --git a/src/switch.c b/src/switch.c index 7d4d1a8217..49ca107f67 100644 --- a/src/switch.c +++ b/src/switch.c @@ -875,6 +875,8 @@ int main(int argc, char *argv[]) apr_pool_create(&pool, NULL); + switch_filepath_set(SWITCH_GLOBAL_dirs.base_dir, pool); + switch_dir_make_recursive(SWITCH_GLOBAL_dirs.run_dir, SWITCH_DEFAULT_DIR_PERMS, pool); if (switch_file_open(&fd, pid_path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, pool) == SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_apr.c b/src/switch_apr.c index 495e0605a8..24c966e6dc 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -403,6 +403,11 @@ SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const ch return apr_file_open(newf, fname, flag, perm, pool); } +SWITCH_DECLARE(switch_status_t) switch_filepath_set(const char *path, switch_memory_pool_t *pool) +{ + return apr_filepath_set(path, pool); +} + SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset) { apr_status_t rv;