aboutsummaryrefslogtreecommitdiff
path: root/lib/utils_base.c
diff options
context:
space:
mode:
authorGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2014-06-21 15:15:44 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2014-06-21 15:15:44 +0200
commiteb85a612a3321c57efbd672f8b11bfefbc659876 (patch)
tree6ac50ffdffff6926da7e4412559970dba823f376 /lib/utils_base.c
parent8a932865eb6082a66d2ceb73354bd6bb5a2b90ab (diff)
downloadmonitoring-plugins-eb85a612a3321c57efbd672f8b11bfefbc659876.tar.gz
Add UID to state retention file path
Add the UID of the invoking user to the state retention file path. This helps solving permission issues when different users run the same plugin.
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r--lib/utils_base.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c
index 04c4b4f9..55d35fdd 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -489,7 +489,9 @@ void np_enable_state(char *keyname, int expected_data_version) {
this_state->state_data=NULL;
/* Calculate filename */
- asprintf(&temp_filename, "%s/%s/%s", _np_state_calculate_location_prefix(), this_monitoring_plugin->plugin_name, this_state->name);
+ asprintf(&temp_filename, "%s/%lu/%s/%s",
+ _np_state_calculate_location_prefix(), (unsigned long)geteuid(),
+ this_monitoring_plugin->plugin_name, this_state->name);
this_state->_filename=temp_filename;
this_monitoring_plugin->state = this_state;