Skip to content

Commit 398aeaa

Browse files
authored
Merge pull request #984 from klaernie/expand-undef-cv-macros-empty
expand macros for non-existant custom variable as empty string
2 parents 63bcbce + e28b8db commit 398aeaa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Changelog

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Nagios Core 4 Change Log
77
* Send a recovery notification if the object recovered while flapping (#847) (Dylan Anderson)
88
* Fix for separate build directory & a couple small cleanups (Doug Nazar)
99
* Update tutorial links in Readme (Igor Udot)
10+
* Expand the custom variable macros to an empty string, if the custom variable does not exist
1011

1112
4.5.5 - 2024-09-17
1213
------------------

common/macros.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,7 @@ int grab_custom_object_macro_r(nagios_macros *mac, char *macro_name, customvaria
24672467
customvariablesmember *temp_customvariablesmember = NULL;
24682468
int result = ERROR;
24692469

2470-
if(macro_name == NULL || vars == NULL || output == NULL)
2470+
if(macro_name == NULL || output == NULL)
24712471
return ERROR;
24722472

24732473
/* get the custom variable */
@@ -2484,6 +2484,12 @@ int grab_custom_object_macro_r(nagios_macros *mac, char *macro_name, customvaria
24842484
}
24852485
}
24862486

2487+
/* expand nonexistant custom variables as an empty string */
2488+
if( result == ERROR ){
2489+
*output = "";
2490+
result = OK;
2491+
}
2492+
24872493
return result;
24882494
}
24892495

0 commit comments

Comments
 (0)