These functions can't fail really. Drop checking of their retval then. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/locking/lock_daemon.c | 17 +++++------------ src/locking/lock_daemon_config.c | 5 +---- src/locking/lock_driver_lockd.c | 9 ++------- src/locking/lock_driver_sanlock.c | 12 ++++-------- src/locking/lock_manager.c | 4 +--- 5 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 7d8c11a2a3..dc23179009 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -464,11 +464,8 @@ virLockDaemonUnixSocketPaths(bool privileged, } umask(old_umask); - if (virAsprintf(sockfile, "%s/virtlockd-sock", rundir) < 0 || - virAsprintf(adminSockfile, "%s/virtlockd-admin-sock", rundir) < 0) { - VIR_FREE(rundir); - goto error; - } + virAsprintf(sockfile, "%s/virtlockd-sock", rundir); + virAsprintf(adminSockfile, "%s/virtlockd-admin-sock", rundir); VIR_FREE(rundir); } @@ -531,8 +528,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config, /* Define the default output. This is only applied if there was no setting * from either the config or the environment. */ - if (virLogSetDefaultOutput("virtlockd", godaemon, privileged) < 0) - return -1; + virLogSetDefaultOutput("virtlockd", godaemon, privileged); if (virLogGetNbOutputs() == 0) virLogSetOutputs(virLogGetDefaultOutput()); @@ -845,10 +841,7 @@ virLockDaemonExecRestartStatePath(bool privileged, } umask(old_umask); - if (virAsprintf(state_file, "%s/virtlockd-restart-exec.json", rundir) < 0) { - VIR_FREE(rundir); - goto error; - } + virAsprintf(state_file, "%s/virtlockd-restart-exec.json", rundir); VIR_FREE(rundir); } @@ -865,7 +858,7 @@ virLockDaemonGetExecRestartMagic(void) { char *ret; - ignore_value(virAsprintf(&ret, "%lld", (long long int)getpid())); + virAsprintf(&ret, "%lld", (long long int)getpid()); return ret; } diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c index 6e635f1e0b..e77e2b7bf6 100644 --- a/src/locking/lock_daemon_config.c +++ b/src/locking/lock_daemon_config.c @@ -46,10 +46,7 @@ virLockDaemonConfigFilePath(bool privileged, char **configfile) if (!(configdir = virGetUserConfigDirectory())) goto error; - if (virAsprintf(configfile, "%s/virtlockd.conf", configdir) < 0) { - VIR_FREE(configdir); - goto error; - } + virAsprintf(configfile, "%s/virtlockd.conf", configdir); VIR_FREE(configdir); } diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c index 9452f2957c..73f699044b 100644 --- a/src/locking/lock_driver_lockd.c +++ b/src/locking/lock_driver_lockd.c @@ -127,10 +127,7 @@ static char *virLockManagerLockDaemonPath(bool privileged) if (!(rundir = virGetUserRuntimeDirectory())) return NULL; - if (virAsprintf(&path, "%s/virtlockd-sock", rundir) < 0) { - VIR_FREE(rundir); - return NULL; - } + virAsprintf(&path, "%s/virtlockd-sock", rundir); VIR_FREE(rundir); } @@ -577,9 +574,7 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock, _("Missing path or lockspace for lease resource")); goto cleanup; } - if (virAsprintf(&newLockspace, "%s/%s", - path, lockspace) < 0) - goto cleanup; + virAsprintf(&newLockspace, "%s/%s", path, lockspace); newName = g_strdup(name); } break; diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index beeeb6066b..0aee93c195 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -103,7 +103,7 @@ virLockManagerSanlockError(int err, #if HAVE_SANLOCK_STRERROR *message = g_strdup(sanlock_strerror(err)); #else - ignore_value(virAsprintfQuiet(message, _("sanlock error %d"), err)); + virAsprintfQuiet(message, _("sanlock error %d"), err); #endif return true; } else { @@ -211,10 +211,8 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver) char *dir = NULL; int retries = LOCKSPACE_RETRIES; - if (virAsprintf(&path, "%s/%s", - driver->autoDiskLeasePath, - VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE) < 0) - goto error; + virAsprintf(&path, "%s/%s", driver->autoDiskLeasePath, + VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE); if (virStrcpyStatic(ls.name, VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE) < 0) { @@ -645,9 +643,7 @@ virLockManagerSanlockAddDisk(virLockManagerSanlockDriverPtr driver, goto cleanup; } - if (virAsprintf(&path, "%s/%s", - driver->autoDiskLeasePath, res->name) < 0) - goto cleanup; + virAsprintf(&path, "%s/%s", driver->autoDiskLeasePath, res->name); if (virStrcpy(res->disks[0].path, path, SANLK_PATH_LEN) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Lease path '%s' exceeds %d characters"), diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c index 6898bfc556..0986cafe6c 100644 --- a/src/locking/lock_manager.c +++ b/src/locking/lock_manager.c @@ -131,9 +131,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name, VIR_DEBUG("name=%s driverName=%s configDir=%s flags=0x%x", name, driverName, configDir, flags); - if (virAsprintf(&configFile, "%s/%s-%s.conf", - configDir, driverName, name) < 0) - return NULL; + virAsprintf(&configFile, "%s/%s-%s.conf", configDir, driverName, name); if (STREQ(name, "nop")) { driver = &virLockDriverNop; -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list