From 99474f8e5012a53377e735755e47bd3e18fc17a9 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Mon, 16 Dec 2024 12:41:08 +0300 Subject: [PATCH] logging: Change return type of virLogDaemonConfigFilePat to void This function return value is invariant since 18f3771, so change its type and remove all dependent checks. Found by Linux Verification Center (linuxtesting.org) with Svace. Reported-by: Pavel Nekrasov Signed-off-by: Alexander Kuznetsov Reviewed-by: Jiri Denemark --- src/logging/log_daemon.c | 8 ++------ src/logging/log_daemon_config.c | 4 +--- src/logging/log_daemon_config.h | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 606aafd071..16a5dcea9a 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -692,14 +692,10 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - /* No explicit config, so try and find a default one */ + /* No explicit config, so find a default one */ if (remote_config_file == NULL) { implicit_conf = true; - if (virLogDaemonConfigFilePath(privileged, - &remote_config_file) < 0) { - VIR_ERROR(_("Can't determine config path")); - exit(EXIT_FAILURE); - } + virLogDaemonConfigFilePath(privileged, &remote_config_file); } /* Read the config file if it exists */ diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_config.c index 248bd927d3..60c424ad84 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -33,7 +33,7 @@ VIR_LOG_INIT("logging.log_daemon_config"); -int +void virLogDaemonConfigFilePath(bool privileged, char **configfile) { if (privileged) { @@ -45,8 +45,6 @@ virLogDaemonConfigFilePath(bool privileged, char **configfile) *configfile = g_strdup_printf("%s/virtlogd.conf", configdir); } - - return 0; } diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_config.h index 43922feedf..5c10cc50d7 100644 --- a/src/logging/log_daemon_config.h +++ b/src/logging/log_daemon_config.h @@ -39,7 +39,7 @@ struct _virLogDaemonConfig { }; -int virLogDaemonConfigFilePath(bool privileged, char **configfile); +void virLogDaemonConfigFilePath(bool privileged, char **configfile); virLogDaemonConfig *virLogDaemonConfigNew(bool privileged); void virLogDaemonConfigFree(virLogDaemonConfig *data); int virLogDaemonConfigLoadFile(virLogDaemonConfig *data,