mirror of
https://github.com/kakwa/uts-server
synced 2025-07-04 20:47:09 +02:00
add handling of NULL strings in logs
replace NULL char * by const char * "<undef>" in log messages as printf("%s", NULL) behavior is not formalized.
This commit is contained in:
parent
1d7c9cd588
commit
822b97a035
3 changed files with 21 additions and 13 deletions
|
@ -202,6 +202,12 @@ void uts_logger(rfc3161_context *ct, int priority, char *fmt, ...) {
|
|||
free(out);
|
||||
}
|
||||
|
||||
const char *null_undef(const char * in){
|
||||
if(in == NULL)
|
||||
return "<undef>";
|
||||
return in;
|
||||
}
|
||||
|
||||
// OpenSSL file openner (use for opening the configuration file
|
||||
static BIO *bio_open_default(rfc3161_context *ct, const char *filename,
|
||||
int format) {
|
||||
|
@ -281,7 +287,7 @@ int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
|||
if (value == NULL) {
|
||||
uts_logger(ct, LOG_NOTICE,
|
||||
"configuration param['%s'] not set, using default: '%s'",
|
||||
name, default_value);
|
||||
name, null_undef(default_value));
|
||||
value = default_value;
|
||||
}
|
||||
switch (type) {
|
||||
|
@ -307,11 +313,11 @@ int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
|||
if (value == NULL) {
|
||||
uts_logger(ct, LOG_NOTICE,
|
||||
"configuration param['%s'] not set, using default: '%s'",
|
||||
name, default_value);
|
||||
name, null_undef(default_value));
|
||||
value = default_value;
|
||||
}
|
||||
uts_logger(ct, LOG_DEBUG, "configuration param['%s'] = '%s'", name,
|
||||
value);
|
||||
null_undef(value));
|
||||
switch (type) {
|
||||
// if it's an http (civetweb) option, put it in the http_options buffer
|
||||
// like civetweb is expected it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue