[PATCH v2 4/4] logging: Change return type of virLogDaemonConfigFilePat to void

Alexander Kuznetsov posted 4 patches 4 weeks ago
There is a newer version of this series
[PATCH v2 4/4] logging: Change return type of virLogDaemonConfigFilePat to void
Posted by Alexander Kuznetsov 4 weeks ago
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 <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
---
 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 daf7ef4b2f..5a9be4a44e 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,
-- 
2.42.2
Re: [PATCH v2 4/4] logging: Change return type of virLogDaemonConfigFilePat to void
Posted by Jiri Denemark 1 week, 6 days ago
On Thu, Nov 28, 2024 at 16:28:10 +0300, Alexander Kuznetsov wrote:
> 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 <p.nekrasov@fobos-nt.ru>
> Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
> ---
>  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(-)

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>