These functions can't fail really. Drop checking of their retval then. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/logging/log_daemon.c | 26 +++++++------------------- src/logging/log_daemon_config.c | 5 +---- src/logging/log_manager.c | 5 +---- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 73bd3c4ac2..2304c310d1 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -405,11 +405,8 @@ virLogDaemonUnixSocketPaths(bool privileged, } umask(old_umask); - if (virAsprintf(sockfile, "%s/virtlogd-sock", rundir) < 0 || - virAsprintf(adminSockfile, "%s/virtlogd-admin-sock", rundir) < 0) { - VIR_FREE(rundir); - goto error; - } + virAsprintf(sockfile, "%s/virtlogd-sock", rundir); + virAsprintf(adminSockfile, "%s/virtlogd-admin-sock", rundir); VIR_FREE(rundir); } @@ -429,7 +426,7 @@ virLogDaemonErrorHandler(void *opaque G_GNUC_UNUSED, } -static int +static void virLogDaemonSetupLogging(virLogDaemonConfigPtr config, bool privileged, bool verbose, @@ -466,13 +463,10 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config, /* Define the default output. This is only applied if there was no setting * from either the config or the environment. */ - if (virLogSetDefaultOutput("virtlogd", godaemon, privileged) < 0) - return -1; + virLogSetDefaultOutput("virtlogd", godaemon, privileged); if (virLogGetNbOutputs() == 0) virLogSetOutputs(virLogGetDefaultOutput()); - - return 0; } @@ -638,10 +632,7 @@ virLogDaemonExecRestartStatePath(bool privileged, } umask(old_umask); - if (virAsprintf(state_file, "%s/virtlogd-restart-exec.json", rundir) < 0) { - VIR_FREE(rundir); - goto error; - } + virAsprintf(state_file, "%s/virtlogd-restart-exec.json", rundir); VIR_FREE(rundir); } @@ -658,7 +649,7 @@ virLogDaemonGetExecRestartMagic(void) { char *ret; - ignore_value(virAsprintf(&ret, "%lld", (long long int)getpid())); + virAsprintf(&ret, "%lld", (long long int)getpid()); return ret; } @@ -980,10 +971,7 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - if (virLogDaemonSetupLogging(config, privileged, verbose, godaemon) < 0) { - VIR_ERROR(_("Can't initialize logging")); - exit(EXIT_FAILURE); - } + virLogDaemonSetupLogging(config, privileged, verbose, godaemon); if (!pid_file && virPidFileConstructPath(privileged, diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_config.c index df7c6339b7..a0e4c4dd1b 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -47,10 +47,7 @@ virLogDaemonConfigFilePath(bool privileged, char **configfile) if (!(configdir = virGetUserConfigDirectory())) goto error; - if (virAsprintf(configfile, "%s/virtlogd.conf", configdir) < 0) { - VIR_FREE(configdir); - goto error; - } + virAsprintf(configfile, "%s/virtlogd.conf", configdir); VIR_FREE(configdir); } diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c index b60a6aaf59..024fe9b592 100644 --- a/src/logging/log_manager.c +++ b/src/logging/log_manager.c @@ -52,10 +52,7 @@ virLogManagerDaemonPath(bool privileged) if (!(rundir = virGetUserRuntimeDirectory())) return NULL; - if (virAsprintf(&path, "%s/virtlogd-sock", rundir) < 0) { - VIR_FREE(rundir); - return NULL; - } + virAsprintf(&path, "%s/virtlogd-sock", rundir); VIR_FREE(rundir); } -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list