Module: kamailio
Branch: 5.4
Commit: 0e545fa3dd8221c76a6abe11b7a90a752be30e6c
URL:
https://github.com/kamailio/kamailio/commit/0e545fa3dd8221c76a6abe11b7a90a7…
Author: frederic <frederic.gaisnon(a)mmtt.fr>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-03-09T09:12:51+01:00
cplc: manage case where TZ environment variable is not set.
(cherry picked from commit 2ea56a4cf40045bb92b1f17f5a0b8c172da4f866)
(cherry picked from commit 67d888c80f5c9e96da72a1dab234f2a70782f635)
---
Modified: src/modules/cplc/cpl_switches.h
---
Diff:
https://github.com/kamailio/kamailio/commit/0e545fa3dd8221c76a6abe11b7a90a7…
Patch:
https://github.com/kamailio/kamailio/commit/0e545fa3dd8221c76a6abe11b7a90a7…
---
diff --git a/src/modules/cplc/cpl_switches.h b/src/modules/cplc/cpl_switches.h
index 9bb90dc5db..035d8d06e4 100644
--- a/src/modules/cplc/cpl_switches.h
+++ b/src/modules/cplc/cpl_switches.h
@@ -815,7 +815,7 @@ static inline char *run_time_switch( struct cpl_interpreter *intr )
/* does the recv_time match the specified interval? */
j = cpl_check_tmrec( &trt, &att, 0);
/* restore the orig TZ */
- if ( flags&(1<<7) )
+ if ((flags&(1<<7)) && cpl_env.orig_tz.s
&& (cpl_env.orig_tz.len > 3))
set_TZ(cpl_env.orig_tz.s);
/* free structs that I don't need any more */
cpl_ac_tm_free( &att );
@@ -848,7 +848,7 @@ static inline char *run_time_switch( struct cpl_interpreter *intr )
cpl_tmrec_free( &trt );
return DEFAULT_ACTION;
runtime_error:
- if ( flags&(1<<7) )
+ if ((flags&(1<<7)) && cpl_env.orig_tz.s &&
(cpl_env.orig_tz.len > 3))
set_TZ(cpl_env.orig_tz.s);
cpl_ac_tm_free( &att );
cpl_tmrec_free( &trt );
@@ -857,7 +857,7 @@ static inline char *run_time_switch( struct cpl_interpreter *intr )
LM_ERR("error parsing attr [%d][%s]\n",
attr_name,attr_str?(char*)attr_str:"NULL");
script_error:
- if ( flags&(1<<7) )
+ if ((flags&(1<<7)) && cpl_env.orig_tz.s &&
(cpl_env.orig_tz.len > 3))
set_TZ(cpl_env.orig_tz.s);
cpl_ac_tm_free( &att );
cpl_tmrec_free( &trt );