These functions can't fail really. Drop checking of their retval
then.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/driver.c | 6 ++----
src/libvirt-admin.c | 12 +++++-------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/driver.c b/src/driver.c
index 125cf02890..89851cb629 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -90,8 +90,7 @@ virDriverShouldAutostart(const char *dir,
*autostart = false;
- if (virAsprintf(&path, "%s/autostarted", dir) < 0)
- return -1;
+ virAsprintf(&path, "%s/autostarted", dir);
if (virFileExists(path)) {
VIR_DEBUG("Autostart file %s exists, skipping autostart", path);
@@ -152,8 +151,7 @@ virGetConnectGeneric(virThreadLocalPtr threadPtr, const char *name)
g_autofree char *uri = NULL;
const char *uriPath = geteuid() == 0 ? "/system" :
"/session";
- if (virAsprintf(&uri, "%s://%s", name, uriPath) < 0)
- return NULL;
+ virAsprintf(&uri, "%s://%s", name, uriPath);
conn = virConnectOpen(uri);
VIR_DEBUG("Opened new %s connection %p", name, conn);
diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index 9a18ea0f8b..7ff549bca4 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -141,18 +141,16 @@ getSocketPath(virURIPtr uri)
if (legacy) {
sockbase = g_strdup("libvirt-admin-sock");
} else {
- if (virAsprintf(&sockbase, "%s-admin-sock", uri->scheme)
< 0)
- goto error;
+ virAsprintf(&sockbase, "%s-admin-sock", uri->scheme);
}
if (STREQ_NULLABLE(uri->path, "/system")) {
- if (virAsprintf(&sock_path, RUNSTATEDIR "/libvirt/%s",
- sockbase) < 0)
- goto error;
+ virAsprintf(&sock_path, RUNSTATEDIR "/libvirt/%s", sockbase);
} else if (STREQ_NULLABLE(uri->path, "/session")) {
- if (!rundir || virAsprintf(&sock_path, "%s/%s", rundir,
- sockbase) < 0)
+ if (!rundir)
goto error;
+
+ virAsprintf(&sock_path, "%s/%s", rundir, sockbase);
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid URI path '%s', try
'/system'"),
--
2.21.0