Skip to content

Commit

Permalink
jsonrpc-s: take in consideration run_dir value if fifo path is not ab…
Browse files Browse the repository at this point in the history
…solute
  • Loading branch information
miconda committed May 4, 2015
1 parent e1d68c3 commit d7c1520
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions modules/jsonrpc-s/jsonrpc-s_mod.c
Expand Up @@ -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) {
Expand All @@ -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");
Expand Down

0 comments on commit d7c1520

Please sign in to comment.