From 2ae7a3f96563c6cf3ea21445e7958314b6ca20fb Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Sat, 3 Dec 2022 19:02:11 +0000 Subject: JSON: remove incorrect config value check The `u.string` member of a config entry is an array, and so never `NULL`. Output the device string unconditionally. Signed-off-by: Jeremy Sowden Signed-off-by: Pablo Neira Ayuso --- output/ulogd_output_JSON.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'output/ulogd_output_JSON.c') diff --git a/output/ulogd_output_JSON.c b/output/ulogd_output_JSON.c index bbc3dba..798cb48 100644 --- a/output/ulogd_output_JSON.c +++ b/output/ulogd_output_JSON.c @@ -276,8 +276,8 @@ static int json_interp_file(struct ulogd_pluginstance *upi, char *buf) static int json_interp(struct ulogd_pluginstance *upi) { struct json_priv *opi = (struct json_priv *) &upi->private; + char *dvc, *buf, *tmp; unsigned int i; - char *buf, *tmp; size_t buflen; json_t *msg; @@ -335,10 +335,8 @@ static int json_interp(struct ulogd_pluginstance *upi) json_object_set_new(msg, "timestamp", json_string(timestr)); } - if (upi->config_kset->ces[JSON_CONF_DEVICE].u.string) { - char *dvc = upi->config_kset->ces[JSON_CONF_DEVICE].u.string; - json_object_set_new(msg, "dvc", json_string(dvc)); - } + dvc = upi->config_kset->ces[JSON_CONF_DEVICE].u.string; + json_object_set_new(msg, "dvc", json_string(dvc)); for (i = 0; i < upi->input.num_keys; i++) { struct ulogd_key *key = upi->input.keys[i].u.source; -- cgit v1.2.3