Module: kamailio
Branch: master
Commit: d7c1520ad4dd83e949ebe1b64ec07c6963982390
URL:
https://github.com/kamailio/kamailio/commit/d7c1520ad4dd83e949ebe1b64ec07c6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-04T21:20:42+02:00
jsonrpc-s: take in consideration run_dir value if fifo path is not absolute
---
Modified: modules/jsonrpc-s/jsonrpc-s_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d7c1520ad4dd83e949ebe1b64ec07c6…
Patch:
https://github.com/kamailio/kamailio/commit/d7c1520ad4dd83e949ebe1b64ec07c6…
---
diff --git a/modules/jsonrpc-s/jsonrpc-s_mod.c b/modules/jsonrpc-s/jsonrpc-s_mod.c
index eb84b62..a5c877b 100644
--- a/modules/jsonrpc-s/jsonrpc-s_mod.c
+++ b/modules/jsonrpc-s/jsonrpc-s_mod.c
@@ -893,6 +893,10 @@ static void jsonrpc_clean_context(jsonrpc_ctx_t* ctx)
static int mod_init(void)
{
+ int sep;
+ int len;
+ char *p;
+
/* bind the XHTTP API */
if(jsonrpc_transport==0 || jsonrpc_transport==1) {
if (xhttp_load_api(&xhttp_api) < 0) {
@@ -905,6 +909,28 @@ static int mod_init(void)
}
}
if(jsonrpc_transport==0 || jsonrpc_transport==2) {
+ if(jsonrpc_fifo != NULL && *jsonrpc_fifo!=0) {
+ if(*jsonrpc_fifo != '/') {
+ if(runtime_dir!=NULL && *runtime_dir!=0) {
+ len = strlen(runtime_dir);
+ sep = 0;
+ if(runtime_dir[len-1]!='/') {
+ sep = 1;
+ }
+ len += sep + strlen(jsonrpc_fifo);
+ p = pkg_malloc(len + 1);
+ if(p==NULL) {
+ LM_ERR("no more pkg\n");
+ return -1;
+ }
+ strcpy(p, runtime_dir);
+ if(sep) strcat(p, "/");
+ strcat(p, jsonrpc_fifo);
+ jsonrpc_fifo = p;
+ LM_DBG("fifo path is [%s]\n", jsonrpc_fifo);
+ }
+ }
+ }
if(jsonrpc_init_fifo_file()<0) {
if(jsonrpc_transport==2) {
LM_ERR("cannot initialize fifo transport\n");