[PATCH 2/3] remote: remove unnecessary return value and if branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: jiangjiacheng <jiangjiacheng@xxxxxxxxxx>

Function daemonConfigFilePath() will assign a path to
remote_config_file definitely and the path will be validated
in following codes. So, it's unnecessary to return value
from daemonConfigFilePath() and check the returned value.

Signed-off-by: jiangjiacheng <jiangjiacheng@xxxxxxxxxx>
---
 src/remote/remote_daemon.c        | 6 +-----
 src/remote/remote_daemon_config.c | 4 +---
 src/remote/remote_daemon_config.h | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 23a5eeb200..36d95de83d 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -903,11 +903,7 @@ int main(int argc, char **argv) {
     /* No explicit config, so try and find a default one */
     if (remote_config_file == NULL) {
         implicit_conf = true;
-        if (daemonConfigFilePath(privileged,
-                                 &remote_config_file) < 0) {
-            VIR_ERROR(_("Can't determine config path"));
-            exit(EXIT_FAILURE);
-        }
+        daemonConfigFilePath(privileged, &remote_config_file);
     }
 
     /* Read the config file if it exists */
diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_config.c
index 330db54651..3567e337c4 100644
--- a/src/remote/remote_daemon_config.c
+++ b/src/remote/remote_daemon_config.c
@@ -72,7 +72,7 @@ remoteConfigGetAuth(virConf *conf,
     return 0;
 }
 
-int
+void
 daemonConfigFilePath(bool privileged, char **configfile)
 {
     if (privileged) {
@@ -84,8 +84,6 @@ daemonConfigFilePath(bool privileged, char **configfile)
 
         *configfile = g_strdup_printf("%s/%s.conf", configdir, DAEMON_NAME);
     }
-
-    return 0;
 }
 
 struct daemonConfig*
diff --git a/src/remote/remote_daemon_config.h b/src/remote/remote_daemon_config.h
index 47839271d3..9f9e54e838 100644
--- a/src/remote/remote_daemon_config.h
+++ b/src/remote/remote_daemon_config.h
@@ -99,7 +99,7 @@ struct daemonConfig {
 };
 
 
-int daemonConfigFilePath(bool privileged, char **configfile);
+void daemonConfigFilePath(bool privileged, char **configfile);
 struct daemonConfig* daemonConfigNew(bool privileged);
 void daemonConfigFree(struct daemonConfig *data);
 int daemonConfigLoadFile(struct daemonConfig *data,
-- 
2.33.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux