summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/umberlog.c6
-rw-r--r--t/test_umberlog.c8
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/umberlog.c b/lib/umberlog.c
index 7231065..877818a 100644
--- a/lib/umberlog.c
+++ b/lib/umberlog.c
@@ -77,7 +77,7 @@ static struct
} ul_process_data =
{
PTHREAD_MUTEX_INITIALIZER, 0, LOG_USER, NULL,
- -1, 0, 0, { 0, }
+ -1, (uid_t)-1, (gid_t)-1, { 0, }
};
static __thread ul_buffer_t ul_buffer;
@@ -134,8 +134,8 @@ ul_closelog (void)
ul_process_data.ident = NULL;
ul_process_data.pid = -1;
- ul_process_data.gid = 0;
- ul_process_data.uid = 0;
+ ul_process_data.gid = (gid_t)-1;
+ ul_process_data.uid = (uid_t)-1;
ul_process_data.hostname[0] = '\0';
pthread_mutex_unlock (&ul_process_data.lock);
}
diff --git a/t/test_umberlog.c b/t/test_umberlog.c
index aa50484..8a47ab1 100644
--- a/t/test_umberlog.c
+++ b/t/test_umberlog.c
@@ -291,6 +291,10 @@ START_TEST (test_closelog)
verify_value_missing (jo, "program");
#endif
verify_value_differs (jo, "pid", "0");
+ if (getuid () != 0)
+ verify_value_differs (jo, "uid", "0");
+ if (getgid () != 0)
+ verify_value_differs (jo, "gid", "0");
json_object_put (jo);
}
@@ -346,6 +350,10 @@ START_TEST (test_openlog_defaults)
verify_value_missing (jo, "program");
#endif
verify_value_differs (jo, "pid", "0");
+ if (getuid () != 0)
+ verify_value_differs (jo, "uid", "0");
+ if (getgid () != 0)
+ verify_value_differs (jo, "gid", "0");
json_object_put (jo);
closelog ();