From nobody Sun Feb 8 15:30:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571752732; cv=none; d=zoho.com; s=zohoarc; b=IPzT2Ikh/fJLPquzJxAMDFNUv9pRMNKSmOmPAq3qALs6z11CuLzytVAO1YVVocSIW4mi9E7CpdQ4gspNG6hXgPdDm5V9g3o2nfl72o5fgJTuYN5fQg19/554zun/2EyrRvih8AQEMb4x4H9zTc8vbBNn+S/Sbe4nQU9rwKP+bmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571752732; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e5WowoKzGmUiTsczwLTngeBn3E1CaVx2aJJ69pAlBY8=; b=fTguc6ZdlH5bB97coYMCHtwDvbyr3Ttkz6kXN+cmI354yG6i5DBdFMlL9SNTobrv4dY6OU1PefVnrKgMoKXa7nH2fEL2/ly0SnA6Ao8JbE69/nzmWuaCc8EujMAejzkjoZWRP0Eh0d+jc/k0KMJ+ZHfIWEZJa28WXorm4aGgBUk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1571752732261356.281584968781; Tue, 22 Oct 2019 06:58:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-8w8pP1hGNaWmYaVU7BIjZA-1; Tue, 22 Oct 2019 09:58:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC2DA1005526; Tue, 22 Oct 2019 13:58:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B249C60619; Tue, 22 Oct 2019 13:58:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6053918037C9; Tue, 22 Oct 2019 13:58:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9MDwdel001636 for ; Tue, 22 Oct 2019 09:58:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 917EE60161; Tue, 22 Oct 2019 13:58:39 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A5B86012C for ; Tue, 22 Oct 2019 13:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571752731; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=e5WowoKzGmUiTsczwLTngeBn3E1CaVx2aJJ69pAlBY8=; b=K2k55o0a9PS1U/lyOTKGeVLUl2fBSEWUXxa4bZTCKtatdYThuyqK31giR1HgnrkoOlmtZA gIJ+gRLCgG5eWCCBhtF/v8hgN5S4KdBNWB6Tg6igRclwomg5wcyokvAd7Ty9+0uZsq+wM4 5cuoamuVwvRm9WSgM1eZXpDzoAO0bog= From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 22 Oct 2019 15:57:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/75] logging: Drop virAsprintf() and virAsprintfQuiet() retval checking X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 8w8pP1hGNaWmYaVU7BIjZA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" These functions can't fail really. Drop checking of their retval then. Signed-off-by: Michal Privoznik --- 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); =20 - 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); =20 VIR_FREE(rundir); } @@ -429,7 +426,7 @@ virLogDaemonErrorHandler(void *opaque G_GNUC_UNUSED, } =20 =20 -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 set= ting * from either the config or the environment. */ - if (virLogSetDefaultOutput("virtlogd", godaemon, privileged) < 0) - return -1; + virLogSetDefaultOutput("virtlogd", godaemon, privileged); =20 if (virLogGetNbOutputs() =3D=3D 0) virLogSetOutputs(virLogGetDefaultOutput()); - - return 0; } =20 =20 @@ -638,10 +632,7 @@ virLogDaemonExecRestartStatePath(bool privileged, } umask(old_umask); =20 - if (virAsprintf(state_file, "%s/virtlogd-restart-exec.json", rundi= r) < 0) { - VIR_FREE(rundir); - goto error; - } + virAsprintf(state_file, "%s/virtlogd-restart-exec.json", rundir); =20 VIR_FREE(rundir); } @@ -658,7 +649,7 @@ virLogDaemonGetExecRestartMagic(void) { char *ret; =20 - ignore_value(virAsprintf(&ret, "%lld", (long long int)getpid())); + virAsprintf(&ret, "%lld", (long long int)getpid()); return ret; } =20 @@ -980,10 +971,7 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } =20 - if (virLogDaemonSetupLogging(config, privileged, verbose, godaemon) < = 0) { - VIR_ERROR(_("Can't initialize logging")); - exit(EXIT_FAILURE); - } + virLogDaemonSetupLogging(config, privileged, verbose, godaemon); =20 if (!pid_file && virPidFileConstructPath(privileged, diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_confi= g.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 **confi= gfile) if (!(configdir =3D virGetUserConfigDirectory())) goto error; =20 - if (virAsprintf(configfile, "%s/virtlogd.conf", configdir) < 0) { - VIR_FREE(configdir); - goto error; - } + virAsprintf(configfile, "%s/virtlogd.conf", configdir); VIR_FREE(configdir); } =20 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 =3D virGetUserRuntimeDirectory())) return NULL; =20 - if (virAsprintf(&path, "%s/virtlogd-sock", rundir) < 0) { - VIR_FREE(rundir); - return NULL; - } + virAsprintf(&path, "%s/virtlogd-sock", rundir); =20 VIR_FREE(rundir); } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list