From nobody Sun May 5 11:42:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1583846689; cv=none; d=zohomail.com; s=zohoarc; b=RUGBGy6CsufbKlHnA4q5UfSmuva8hruI9P875F5e4KLTOdvCweX7djzOjfa4dlxF8yBoEYNH785nNJguVk7Lc2rPZVoIrqkrnsZ5sHuJrAVWy3ltxby8Eu2ECbGXwgxNx+DNGYX9t1yOmOGQOlIMbh9TfHnI7a3rQzAsb59URJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583846689; 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=uji+WYYRfvGMkQwV0fj0JoAFwJNbEETJNMHPqPXwn9I=; b=HRzw63mzcPnh7mp47dULCobGmwQwQBlNe3+Q9KLrvigCgTBqWf9Sh2+hMGZCYUAbgeZfL2nYJrkSDBkzGHgAf8gMaEvEYPJLEo/om8yBsFEa/lwzKRm4ll+eiHV/qWorDvAC2beSQnpZxM2/6Pw4r0XT0VRRAR+N9NvhWpq//DM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 1583846689338159.3559358749768; Tue, 10 Mar 2020 06:24:49 -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-78-ajObfZfiOVulbs4CXLILIQ-1; Tue, 10 Mar 2020 09:24:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 157628017DF; Tue, 10 Mar 2020 13:24:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD9998AC42; Tue, 10 Mar 2020 13:24:38 +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 A439786A06; Tue, 10 Mar 2020 13:24:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02ADOZ2o029743 for ; Tue, 10 Mar 2020 09:24:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E0505D9E2; Tue, 10 Mar 2020 13:24:35 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id C93325D9C5 for ; Tue, 10 Mar 2020 13:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583846688; 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=uji+WYYRfvGMkQwV0fj0JoAFwJNbEETJNMHPqPXwn9I=; b=NA7HbGTu9bJNRZvSyGI8CQkG5mgtAJAeOf/I7Ih3Knt/ES4BaJqFw2ggfRn0qYAhKde+VQ WAY0T8tAddIf9ZC4JDjOCky24Xlz6QeS0gBuMGOz8alHBJY/fVXNgqfkxZiETJJy54xBAg EizDUcGwtpZ231uYvmr7W0OM0z/4pVo= X-MC-Unique: ajObfZfiOVulbs4CXLILIQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] Use g_strerror instead of virStrerror Date: Tue, 10 Mar 2020 14:24:27 +0100 Message-Id: <573fca317011640291321bd9444cd8ab3ecb5fb7.1583846630.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Remove lots of stack-allocated buffers. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/libxl/libxl_conf.c | 3 +-- src/libxl/libxl_driver.c | 11 +++++------ src/libxl/libxl_logger.c | 6 ++---- src/locking/lock_daemon.c | 9 +++------ src/logging/log_daemon.c | 9 +++------ src/lxc/lxc_container.c | 3 +-- src/lxc/lxc_process.c | 7 +++---- src/network/bridge_driver.c | 3 +-- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_interface.c | 3 +-- src/qemu/qemu_process.c | 9 +++------ src/remote/remote_daemon.c | 13 ++++--------- src/security/security_manager.c | 5 ++--- src/security/security_selinux.c | 5 ++--- src/storage/storage_driver.c | 3 +-- src/util/viraudit.c | 3 +-- src/util/vircommand.c | 3 +-- src/util/virfile.c | 3 +-- src/util/virhostcpu.c | 8 +++----- src/util/virlockspace.c | 9 +++------ src/util/virpci.c | 12 ++++-------- src/util/virpidfile.c | 3 +-- src/util/virprocess.c | 3 +-- src/util/virutil.c | 6 ++---- tools/vsh.c | 28 ++++++++++------------------ 25 files changed, 60 insertions(+), 110 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 907df525c5..be5fc505fe 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1740,14 +1740,13 @@ libxlDriverConfigNew(void) int libxlDriverConfigInit(libxlDriverConfigPtr cfg) { - char ebuf[1024]; unsigned int free_mem; =20 if (virFileMakePath(cfg->logDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create log dir '%s': %s"), cfg->logDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return -1; } =20 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index f2387e2a20..cc93f1802d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -654,7 +654,6 @@ libxlStateInitialize(bool privileged, { libxlDriverConfigPtr cfg; g_autofree char *driverConf =3D NULL; - char ebuf[1024]; bool autostart =3D true; =20 if (root !=3D NULL) { @@ -725,35 +724,35 @@ libxlStateInitialize(bool privileged, virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create state dir '%s': %s"), cfg->stateDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto error; } if (virFileMakePath(cfg->libDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create lib dir '%s': %s"), cfg->libDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto error; } if (virFileMakePath(cfg->saveDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create save dir '%s': %s"), cfg->saveDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto error; } if (virFileMakePath(cfg->autoDumpDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create dump dir '%s': %s"), cfg->autoDumpDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto error; } if (virFileMakePath(cfg->channelDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create channel dir '%s': %s"), cfg->channelDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto error; } =20 diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c index 1581a3070c..379d7a8d00 100644 --- a/src/libxl/libxl_logger.c +++ b/src/libxl/libxl_logger.c @@ -67,7 +67,6 @@ libvirt_vmessage(xentoollog_logger *logger_in, char timestamp[VIR_TIME_STRING_BUFLEN]; char *message =3D NULL; char *start, *end; - char ebuf[1024]; =20 VIR_DEBUG("libvirt_vmessage: context=3D'%s' format=3D'%s'", context, f= ormat); =20 @@ -104,7 +103,7 @@ libvirt_vmessage(xentoollog_logger *logger_in, fprintf(logFile, "%s", message); =20 if (errnoval >=3D 0) - fprintf(logFile, ": %s", virStrerror(errnoval, ebuf, sizeof(ebuf))= ); + fprintf(logFile, ": %s", g_strerror(errnoval)); =20 fputc('\n', logFile); fflush(logFile); @@ -192,14 +191,13 @@ libxlLoggerOpenFile(libxlLoggerPtr logger, char *path =3D NULL; FILE *logFile =3D NULL; char *domidstr =3D NULL; - char ebuf[1024]; =20 path =3D g_strdup_printf("%s/%s.log", logger->logDir, name); domidstr =3D g_strdup_printf("%d", id); =20 if (!(logFile =3D fopen(path, "a"))) { VIR_WARN("Failed to open log file %s: %s", - path, virStrerror(errno, ebuf, sizeof(ebuf))); + path, g_strerror(errno)); goto cleanup; } ignore_value(virHashAddEntry(logger->files, domidstr, logFile)); diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 245155206a..a258f7e6f1 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -1225,9 +1225,8 @@ int main(int argc, char **argv) { old_umask =3D umask(077); VIR_DEBUG("Ensuring run dir '%s' exists", run_dir); if (virFileMakePath(run_dir) < 0) { - char ebuf[1024]; VIR_ERROR(_("unable to create rundir %s: %s"), run_dir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); ret =3D VIR_LOCK_DAEMON_ERR_RUNDIR; umask(old_umask); goto cleanup; @@ -1253,17 +1252,15 @@ int main(int argc, char **argv) { }; =20 if (godaemon) { - char ebuf[1024]; - if (chdir("/") < 0) { VIR_ERROR(_("cannot change to root directory: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } =20 if ((statuswrite =3D virLockDaemonForkIntoBackground(argv[0]))= < 0) { VIR_ERROR(_("Failed to fork as daemon: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } } diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 47377deb4f..3319bf1f6f 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -993,9 +993,8 @@ int main(int argc, char **argv) { old_umask =3D umask(077); VIR_DEBUG("Ensuring run dir '%s' exists", run_dir); if (virFileMakePath(run_dir) < 0) { - char ebuf[1024]; VIR_ERROR(_("unable to create rundir %s: %s"), run_dir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); ret =3D VIR_LOG_DAEMON_ERR_RUNDIR; umask(old_umask); goto cleanup; @@ -1023,17 +1022,15 @@ int main(int argc, char **argv) { }; =20 if (godaemon) { - char ebuf[1024]; - if (chdir("/") < 0) { VIR_ERROR(_("cannot change to root directory: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } =20 if ((statuswrite =3D virLogDaemonForkIntoBackground(argv[0])) = < 0) { VIR_ERROR(_("Failed to fork as daemon: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } } diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index ec7104f88a..1c28ecfdb7 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -566,12 +566,11 @@ static int lxcContainerUnmountSubtree(const char *pre= fix, for (i =3D 0; i < nmounts; i++) { VIR_DEBUG("Umount %s", mounts[i]); if (umount(mounts[i]) < 0) { - char ebuf[1024]; failedUmount =3D mounts[i]; saveErrno =3D errno; VIR_WARN("Failed to unmount '%s', trying to detach subtree '%s= ': %s", failedUmount, mounts[nmounts-1], - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); break; } } diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index cd0026f78f..5199f3806e 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -135,14 +135,13 @@ static void lxcProcessRemoveDomainStatus(virLXCDriverConfigPtr cfg, virDomainObjPtr vm) { - char ebuf[1024]; char *file =3D NULL; =20 file =3D g_strdup_printf("%s/%s.xml", cfg->stateDir, vm->def->name); =20 if (unlink(file) < 0 && errno !=3D ENOENT && errno !=3D ENOTDIR) VIR_WARN("Failed to remove domain XML for %s: %s", - vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf))); + vm->def->name, g_strerror(errno)); VIR_FREE(file); } =20 @@ -1410,7 +1409,7 @@ int virLXCProcessStart(virConnectPtr conn, if (safewrite(logfd, timestamp, strlen(timestamp)) < 0 || safewrite(logfd, START_POSTFIX, strlen(START_POSTFIX)) < 0) { VIR_WARN("Unable to write timestamp to logfile: %s", - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); } VIR_FREE(timestamp); =20 @@ -1418,7 +1417,7 @@ int virLXCProcessStart(virConnectPtr conn, virCommandWriteArgLog(cmd, logfd); if ((pos =3D lseek(logfd, 0, SEEK_END)) < 0) VIR_WARN("Unable to seek to end of logfile: %s", - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); =20 VIR_DEBUG("Launching container"); virCommandRawStatus(cmd); diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 369e80a889..ae52455761 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -996,11 +996,10 @@ networkKillDaemon(pid_t pid, if (errno =3D=3D ESRCH) { ret =3D 0; } else { - char ebuf[1024]; VIR_WARN("Failed to terminate %s process %d " "for network '%s' with SIG%s: %s", daemonName, pid, networkName, signame, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); } return ret; } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a75ca0574d..1a599a8787 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4646,10 +4646,9 @@ virQEMUCapsIsValid(void *data, } =20 if (stat(qemuCaps->binary, &sb) < 0) { - char ebuf[1024]; VIR_DEBUG("Failed to stat QEMU binary '%s': %s", qemuCaps->binary, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return false; } =20 diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 8a01eecd83..2b24c73d65 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -351,7 +351,6 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr= cfg, } while (*tapfd < 0 && errno =3D=3D EINTR); =20 if (*tapfd < 0) { - char ebuf[1024]; char *errstr =3D NULL; =20 if (!(cmdstr =3D virCommandToString(cmd, false))) @@ -363,7 +362,7 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr= cfg, =20 virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: failed to communicate with bridge helper: %s%s"), - cmdstr, virStrerror(errno, ebuf, sizeof(ebuf)), + cmdstr, g_strerror(errno), NULLSTR_EMPTY(errstr)); VIR_FREE(errstr); goto cleanup; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 499d39a920..c138ef9af4 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -105,7 +105,6 @@ static void qemuProcessRemoveDomainStatus(virQEMUDriverPtr driver, virDomainObjPtr vm) { - char ebuf[1024]; g_autofree char *file =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); @@ -114,13 +113,13 @@ qemuProcessRemoveDomainStatus(virQEMUDriverPtr driver, =20 if (unlink(file) < 0 && errno !=3D ENOENT && errno !=3D ENOTDIR) VIR_WARN("Failed to remove domain XML for %s: %s", - vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf))); + vm->def->name, g_strerror(errno)); =20 if (priv->pidfile && unlink(priv->pidfile) < 0 && errno !=3D ENOENT) VIR_WARN("Failed to remove PID file for %s: %s", - vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf))); + vm->def->name, g_strerror(errno)); } =20 =20 @@ -8320,13 +8319,11 @@ qemuProcessQMPStop(qemuProcessQMPPtr proc) virDomainObjEndAPI(&proc->vm); =20 if (proc->pid !=3D 0) { - char ebuf[1024]; - VIR_DEBUG("Killing QMP caps process %lld", (long long)proc->pid); if (virProcessKill(proc->pid, SIGKILL) < 0 && errno !=3D ESRCH) VIR_ERROR(_("Failed to kill process %lld: %s"), (long long)proc->pid, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); =20 proc->pid =3D 0; } diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 37e53a87cc..f3b3c70ebf 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -189,12 +189,10 @@ static int daemonForkIntoBackground(const char *argv0) VIR_FORCE_CLOSE(statuspipe[0]); =20 if (ret !=3D 1) { - char ebuf[1024]; - fprintf(stderr, _("%s: error: unable to determine if daemon is " "running: %s\n"), argv0, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); exit(EXIT_FAILURE); } else if (status !=3D 0) { fprintf(stderr, @@ -1194,17 +1192,15 @@ int main(int argc, char **argv) { NULLSTR(sock_file_adm)); =20 if (godaemon) { - char ebuf[1024]; - if (chdir("/") < 0) { VIR_ERROR(_("cannot change to root directory: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } =20 if ((statuswrite =3D daemonForkIntoBackground(argv[0])) < 0) { VIR_ERROR(_("Failed to fork as daemon: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } } @@ -1227,9 +1223,8 @@ int main(int argc, char **argv) { old_umask =3D umask(077); VIR_DEBUG("Ensuring run dir '%s' exists", run_dir); if (virFileMakePath(run_dir) < 0) { - char ebuf[1024]; VIR_ERROR(_("unable to create rundir %s: %s"), run_dir, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); ret =3D VIR_DAEMON_ERR_RUNDIR; goto cleanup; } diff --git a/src/security/security_manager.c b/src/security/security_manage= r.c index 9f4bd7f8df..fe032746ff 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -1407,7 +1407,6 @@ virSecurityManagerMetadataUnlock(virSecurityManagerPt= r mgr G_GNUC_UNUSED, return; =20 for (i =3D 0; i < (*state)->nfds; i++) { - char ebuf[1024]; const char *path =3D (*state)->paths[i]; int fd =3D (*state)->fds[i]; =20 @@ -1415,12 +1414,12 @@ virSecurityManagerMetadataUnlock(virSecurityManager= Ptr mgr G_GNUC_UNUSED, * happen on VIR_CLOSE() anyway. But let's play it nice. */ if (virFileUnlock(fd, METADATA_OFFSET, METADATA_LEN) < 0) { VIR_WARN("Unable to unlock fd %d path %s: %s", - fd, path, virStrerror(errno, ebuf, sizeof(ebuf))); + fd, path, g_strerror(errno)); } =20 if (VIR_CLOSE(fd) < 0) { VIR_WARN("Unable to close fd %d path %s: %s", - fd, path, virStrerror(errno, ebuf, sizeof(ebuf))); + fd, path, g_strerror(errno)); } } =20 diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index e9aa8af877..c94f31727c 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1451,7 +1451,6 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManager= Ptr mgr, struct stat buf; security_context_t fcon =3D NULL; char *newpath =3D NULL; - char ebuf[1024]; int rc; int ret =3D -1; =20 @@ -1465,7 +1464,7 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManager= Ptr mgr, =20 if (virFileResolveLink(path, &newpath) < 0) { VIR_WARN("cannot resolve symlink %s: %s", path, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } =20 @@ -1492,7 +1491,7 @@ virSecuritySELinuxRestoreFileLabel(virSecurityManager= Ptr mgr, if (!recall || rc =3D=3D -2) { if (stat(newpath, &buf) !=3D 0) { VIR_WARN("cannot stat %s: %s", newpath, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); goto cleanup; } =20 diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 1c56527e38..2db763caa5 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -900,9 +900,8 @@ storagePoolUndefine(virStoragePoolPtr pool) =20 if (autostartLink && unlink(autostartLink) < 0 && errno !=3D ENOENT && errno !=3D ENOTDIR) { - char ebuf[1024]; VIR_ERROR(_("Failed to delete autostart link '%s': %s"), - autostartLink, virStrerror(errno, ebuf, sizeof(ebuf))); + autostartLink, g_strerror(errno)); } =20 event =3D virStoragePoolEventLifecycleNew(def->name, diff --git a/src/util/viraudit.c b/src/util/viraudit.c index 13421653b9..6729790a26 100644 --- a/src/util/viraudit.c +++ b/src/util/viraudit.c @@ -121,9 +121,8 @@ void virAuditSend(virLogSourcePtr source, VIR_WARN("Unknown audit record type %d", type); else if (audit_log_user_message(auditfd, record_types[type], str, = NULL, clientaddr, clienttty, success) < = 0) { - char ebuf[1024]; VIR_WARN("Failed to send audit message %s: %s", - NULLSTR(str), virStrerror(errno, ebuf, sizeof(ebuf))); + NULLSTR(str), g_strerror(errno)); } } #endif diff --git a/src/util/vircommand.c b/src/util/vircommand.c index c150d99452..9ffa0cf49b 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2061,9 +2061,8 @@ virCommandWriteArgLog(virCommandPtr cmd, int logfd) } =20 if (ioError) { - char ebuf[1024]; VIR_WARN("Unable to write command %s args to logfile: %s", - cmd->args[0], virStrerror(ioError, ebuf, sizeof(ebuf))); + cmd->args[0], g_strerror(ioError)); } } =20 diff --git a/src/util/virfile.c b/src/util/virfile.c index 589f7ce850..0f31554323 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -127,9 +127,8 @@ int virFileClose(int *fdptr, virFileCloseFlags flags) if (!(flags & VIR_FILE_CLOSE_IGNORE_EBADF)) VIR_WARN("Tried to close invalid fd %d", *fdptr); } else { - char ebuf[1024] G_GNUC_UNUSED; VIR_DEBUG("Failed to close fd %d: %s", - *fdptr, virStrerror(errno, ebuf, sizeof(ebuf))); + *fdptr, g_strerror(errno)); } } else { VIR_DEBUG("Closed fd %d", *fdptr); diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 81293eea8c..c1b39e772a 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1228,9 +1228,8 @@ virHostCPUGetMicrocodeVersion(void) unsigned int version =3D 0; =20 if (virFileReadHeaderQuiet(CPUINFO_PATH, 4096, &outbuf) < 0) { - char ebuf[1024]; VIR_DEBUG("Failed to read microcode version from %s: %s", - CPUINFO_PATH, virStrerror(errno, ebuf, sizeof(ebuf))); + CPUINFO_PATH, g_strerror(errno)); return 0; } =20 @@ -1301,13 +1300,12 @@ virHostCPUGetMSR(unsigned long index, uint64_t *msr) { VIR_AUTOCLOSE fd =3D -1; - char ebuf[1024]; =20 *msr =3D 0; =20 if ((fd =3D open(MSR_DEVICE, O_RDONLY)) < 0) { VIR_DEBUG("Unable to open %s: %s", - MSR_DEVICE, virStrerror(errno, ebuf, sizeof(ebuf))); + MSR_DEVICE, g_strerror(errno)); } else { int rc =3D pread(fd, msr, sizeof(*msr), index); =20 @@ -1320,7 +1318,7 @@ virHostCPUGetMSR(unsigned long index, } =20 VIR_DEBUG("Cannot read MSR 0x%lx from %s: %s", - index, MSR_DEVICE, virStrerror(errno, ebuf, sizeof(ebuf)= )); + index, MSR_DEVICE, g_strerror(errno)); } =20 VIR_DEBUG("Falling back to KVM ioctl"); diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 05517f8b40..9a54192cd1 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -89,17 +89,15 @@ static void virLockSpaceResourceFree(virLockSpaceResour= cePtr res) } else { if (unlink(res->path) < 0 && errno !=3D ENOENT) { - char ebuf[1024]; VIR_WARN("Failed to unlink resource %s: %s", - res->path, virStrerror(errno, ebuf, sizeof(eb= uf))); + res->path, g_strerror(errno)); } } } else { if (unlink(res->path) < 0 && errno !=3D ENOENT) { - char ebuf[1024]; VIR_WARN("Failed to unlink resource %s: %s", - res->path, virStrerror(errno, ebuf, sizeof(ebuf))= ); + res->path, g_strerror(errno)); } } } @@ -173,9 +171,8 @@ virLockSpaceResourceNew(virLockSpacePtr lockspace, * one that now exists on the filesystem */ if (stat(res->path, &a) < 0) { - char ebuf[1024] G_GNUC_UNUSED; VIR_DEBUG("Resource '%s' disappeared: %s", - res->path, virStrerror(errno, ebuf, sizeof(ebuf)= )); + res->path, g_strerror(errno)); VIR_FORCE_CLOSE(res->fd); /* Someone else must be racing with us, so try again */ continue; diff --git a/src/util/virpci.c b/src/util/virpci.c index db9528478d..6c7e6bbcab 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -289,9 +289,8 @@ virPCIDeviceConfigOpenInternal(virPCIDevicePtr dev, boo= l readonly, bool fatal) _("Failed to open config space file '%s'"= ), dev->path); } else { - char ebuf[1024]; VIR_WARN("Failed to open config space file '%s': %s", - dev->path, virStrerror(errno, ebuf, sizeof(ebuf))); + dev->path, g_strerror(errno)); } return -1; } @@ -322,9 +321,8 @@ static void virPCIDeviceConfigClose(virPCIDevicePtr dev, int cfgfd) { if (VIR_CLOSE(cfgfd) < 0) { - char ebuf[1024]; VIR_WARN("Failed to close config space file '%s': %s", - dev->path, virStrerror(errno, ebuf, sizeof(ebuf))); + dev->path, g_strerror(errno)); } } =20 @@ -340,9 +338,8 @@ virPCIDeviceRead(virPCIDevicePtr dev, =20 if (lseek(cfgfd, pos, SEEK_SET) !=3D pos || saferead(cfgfd, buf, buflen) !=3D buflen) { - char ebuf[1024]; VIR_WARN("Failed to read from '%s' : %s", dev->path, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return -1; } return 0; @@ -407,9 +404,8 @@ virPCIDeviceWrite(virPCIDevicePtr dev, { if (lseek(cfgfd, pos, SEEK_SET) !=3D pos || safewrite(cfgfd, buf, buflen) !=3D buflen) { - char ebuf[1024]; VIR_WARN("Failed to write to '%s' : %s", dev->path, - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return -1; } return 0; diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index d5aa5f4f84..1a6fbdc552 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -374,9 +374,8 @@ int virPidFileAcquirePath(const char *path, * one that now exists on the filesystem */ if (stat(path, &a) < 0) { - char ebuf[1024] G_GNUC_UNUSED; VIR_DEBUG("Pid file '%s' disappeared: %s", - path, virStrerror(errno, ebuf, sizeof(ebuf))); + path, g_strerror(errno)); VIR_FORCE_CLOSE(fd); /* Someone else must be racing with us, so try again */ continue; diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 436172590e..24135070b7 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1292,9 +1292,8 @@ virProcessNamespaceAvailable(unsigned int ns) cpid =3D clone(virProcessDummyChild, childStack, flags, NULL); =20 if (cpid < 0) { - char ebuf[1024] G_GNUC_UNUSED; VIR_DEBUG("clone call returned %s, container support is not enable= d", - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return -1; } else if (virProcessWait(cpid, NULL, false) < 0) { return -1; diff --git a/src/util/virutil.c b/src/util/virutil.c index f77ee05dbf..c4945218e1 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -793,12 +793,11 @@ virGetUserIDByName(const char *name, uid_t *uid, bool= missing_ok) =20 if (!pw) { if (rc !=3D 0 && !missing_ok) { - char buf[1024]; /* log the possible error from getpwnam_r. Unfortunately error * reporting from this function is bad and we can't really * rely on it, so we just report that the user wasn't found */ VIR_WARN("User record for user '%s' was not found: %s", - name, virStrerror(rc, buf, sizeof(buf))); + name, g_strerror(rc)); } =20 ret =3D 1; @@ -876,12 +875,11 @@ virGetGroupIDByName(const char *name, gid_t *gid, boo= l missing_ok) =20 if (!gr) { if (rc !=3D 0 && !missing_ok) { - char buf[1024]; /* log the possible error from getgrnam_r. Unfortunately error * reporting from this function is bad and we can't really * rely on it, so we just report that the user wasn't found */ VIR_WARN("Group record for user '%s' was not found: %s", - name, virStrerror(rc, buf, sizeof(buf))); + name, g_strerror(rc)); } =20 ret =3D 1; diff --git a/tools/vsh.c b/tools/vsh.c index d392f5b05b..0488295c10 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1930,7 +1930,7 @@ vshTTYMakeRaw(vshControl *ctl G_GNUC_UNUSED, { #ifndef WIN32 struct termios rawattr =3D ctl->termattr; - char ebuf[1024]; + =20 if (!ctl->istty) { if (report_errors) { @@ -1946,7 +1946,7 @@ vshTTYMakeRaw(vshControl *ctl G_GNUC_UNUSED, if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &rawattr) < 0) { if (report_errors) vshError(ctl, _("unable to set tty attributes: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return -1; } #endif @@ -2120,12 +2120,10 @@ vshEventWait(vshControl *ctl) assert(ctl->eventPipe[0] >=3D 0); while ((rv =3D read(ctl->eventPipe[0], &buf, 1)) < 0 && errno =3D=3D E= INTR); if (rv !=3D 1) { - char ebuf[1024]; - if (!rv) errno =3D EPIPE; vshError(ctl, _("failed to determine loop exit status: %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); return -1; } return buf; @@ -2256,13 +2254,11 @@ vshOutputLogFile(vshControl *ctl, int log_level, co= nst char *msg_format, void vshCloseLogFile(vshControl *ctl) { - char ebuf[1024]; - /* log file close */ if (VIR_CLOSE(ctl->log_fd) < 0) { vshError(ctl, _("%s: failed to write log file: %s"), ctl->logfile ? ctl->logfile : "?", - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); } =20 if (ctl->logfile) { @@ -2366,7 +2362,6 @@ vshEditWriteToTempFile(vshControl *ctl, const char *d= oc) char *ret; const char *tmpdir; int fd; - char ebuf[1024]; =20 tmpdir =3D getenv("TMPDIR"); if (!tmpdir) tmpdir =3D "/tmp"; @@ -2374,14 +2369,14 @@ vshEditWriteToTempFile(vshControl *ctl, const char = *doc) fd =3D g_mkstemp_full(ret, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR); if (fd =3D=3D -1) { vshError(ctl, _("g_mkstemp_full: failed to create temporary file: = %s"), - virStrerror(errno, ebuf, sizeof(ebuf))); + g_strerror(errno)); VIR_FREE(ret); return NULL; } =20 if (safewrite(fd, doc, strlen(doc)) =3D=3D -1) { vshError(ctl, _("write: %s: failed to write to temporary file: %s"= ), - ret, virStrerror(errno, ebuf, sizeof(ebuf))); + ret, g_strerror(errno)); VIR_FORCE_CLOSE(fd); unlink(ret); VIR_FREE(ret); @@ -2389,7 +2384,7 @@ vshEditWriteToTempFile(vshControl *ctl, const char *d= oc) } if (VIR_CLOSE(fd) < 0) { vshError(ctl, _("close: %s: failed to write or close temporary fil= e: %s"), - ret, virStrerror(errno, ebuf, sizeof(ebuf))); + ret, g_strerror(errno)); unlink(ret); VIR_FREE(ret); return NULL; @@ -2459,12 +2454,11 @@ char * vshEditReadBackFile(vshControl *ctl, const char *filename) { char *ret; - char ebuf[1024]; =20 if (virFileReadAll(filename, VSH_MAX_XML_FILE, &ret) =3D=3D -1) { vshError(ctl, _("%s: failed to read temporary file: %s"), - filename, virStrerror(errno, ebuf, sizeof(ebuf))); + filename, g_strerror(errno)); return NULL; } return ret; @@ -2916,9 +2910,8 @@ vshReadlineDeinit(vshControl *ctl) if (ctl->historyfile !=3D NULL) { if (virFileMakePathWithMode(ctl->historydir, 0755) < 0 && errno !=3D EEXIST) { - char ebuf[1024]; vshError(ctl, _("Failed to create '%s': %s"), - ctl->historydir, virStrerror(errno, ebuf, sizeof(ebuf= ))); + ctl->historydir, g_strerror(errno)); } else { write_history(ctl->historyfile); } @@ -3155,7 +3148,6 @@ cmdCd(vshControl *ctl, const vshCmd *cmd) { const char *dir =3D NULL; g_autofree char *dir_malloced =3D NULL; - char ebuf[1024]; =20 if (!ctl->imode) { vshError(ctl, "%s", _("cd: command valid only in interactive mode"= )); @@ -3169,7 +3161,7 @@ cmdCd(vshControl *ctl, const vshCmd *cmd) =20 if (chdir(dir) =3D=3D -1) { vshError(ctl, _("cd: %s: %s"), - virStrerror(errno, ebuf, sizeof(ebuf)), dir); + g_strerror(errno), dir); return false; } =20 --=20 2.24.1 From nobody Sun May 5 11:42:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1583846687; cv=none; d=zohomail.com; s=zohoarc; b=MoerkD+BAxmc49SUPZyZS/vFRrsG1hNKy74MYpPVWrQOFfWoVvpgx1N6CuOxtzjpRcOP/34VnXjgAW9JinedVhZ9ji1Ir9P5H3Wu7itBfB1jsrybRnUiS6gcMtfZ45KxcHxb12HT1TDFqyIF6d8CLa/rHLmudx3oLKR1qFER1pY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583846687; 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=NqgLKNVvYG+nYuh90M9+IjR27yy9kTzcbMbV5slgr9U=; b=hf0JgKSF0MEvdG7MgGhP4WJYw41+Ey+5nyW1puswZfYm2H0akeMngYPg5M6jRqWcofQV3bkHX0Fmwb/uPU3qeQhJhe6BBDk8K62ipd/X3C1YpdlmI/cO3gDcwPMGvDLj68IcIxbOGiwAapQMwS8eH5OvbnzsRWG63NnAtTAyqwQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15838466879207.52802889592931; Tue, 10 Mar 2020 06:24:47 -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-371-TvCczmFLNkWCz_4OKAvz7g-1; Tue, 10 Mar 2020 09:24:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 031AF800D50; Tue, 10 Mar 2020 13:24:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CA1090F5B; Tue, 10 Mar 2020 13:24:38 +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 E622586A09; Tue, 10 Mar 2020 13:24:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02ADOaVc029744 for ; Tue, 10 Mar 2020 09:24:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 732DD5D9E5; Tue, 10 Mar 2020 13:24:36 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED1305D9C5 for ; Tue, 10 Mar 2020 13:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583846687; 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=NqgLKNVvYG+nYuh90M9+IjR27yy9kTzcbMbV5slgr9U=; b=d/Zu653RI3pTV36/sbh6fQPRtbo4okm1AF/CtdULXh2RCfXNRvuvx6Mh3SVnCaR9JJ7Flh fW8axWoya5JjdqmLSe7i871IYYwZ4pwmMHrLCi7E0GgQ1hXbZMDWAkn2LJemMq4hBIjzz0 IILvhHXVWzvXdvVsS8zsm/LPXL7JyAo= X-MC-Unique: TvCczmFLNkWCz_4OKAvz7g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] util: remove virStrerror Date: Tue, 10 Mar 2020 14:24:28 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that we use g_strerror exclusively, remove this unused function. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 1 - src/util/virerror.c | 25 ------------------------- src/util/virerror.h | 2 -- 3 files changed, 28 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 511fb88872..22f6d14ced 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1981,7 +1981,6 @@ virReportOOMErrorFull; virReportSystemErrorFull; virSetError; virSetErrorLogPriorityFunc; -virStrerror; =20 =20 # util/vireventglib.h diff --git a/src/util/virerror.c b/src/util/virerror.c index 16c384d2f9..774c36bca3 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -1307,31 +1307,6 @@ void virReportErrorHelper(int domcode, errno =3D save_errno; } =20 -/** - * virStrerror: - * @theerrno: the errno value - * @errBuf: the buffer to save the error to - * @errBufLen: the buffer length - * - * Generate an error string for the given errno - * - * Returns a pointer to the error string, possibly indicating that the - * error is unknown - */ -const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen) -{ - int save_errno =3D errno; - const char *ret; - const char *str =3D g_strerror(theerrno); - size_t len =3D strlen(str); - - memcpy(errBuf, str, MIN(len, errBufLen)); - errBuf[errBufLen-1] =3D '\0'; - ret =3D errBuf; - errno =3D save_errno; - return ret; -} - /** * virReportSystemErrorFull: * @domcode: the virErrorDomain indicating where it's coming from diff --git a/src/util/virerror.h b/src/util/virerror.h index 2e27655b72..9d3e40d65a 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -192,8 +192,6 @@ void virReportOOMErrorFull(int domcode, int virSetError(virErrorPtr newerr); virErrorPtr virErrorCopyNew(virErrorPtr err); void virDispatchError(virConnectPtr conn); -/* DEPRECATED: use g_strerror() directly */ -const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen); =20 typedef int (*virErrorLogPriorityFunc)(virErrorPtr, int); void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func); --=20 2.24.1 From nobody Sun May 5 11:42:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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=1583846698; cv=none; d=zohomail.com; s=zohoarc; b=P/lcu8j54rY02+Z3SrCH/a+hV3oqgydweqhzwKN/IuL4J1vgWcErT4+eBtwcFSNxKbM/alLJBAO1NfCU7qpP7cA1nk/OaLEflbfwL629LlZWIDMenGaoeRmf9uI7pT6Uw+KD41YLPqMU9soVJvKeCVuvCGSZmfeJL5BTDmVLgz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583846698; 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=2h45NHnevKDjvFgHgcCB4jVLdriKNReqn8jDJ+/aNR0=; b=JS1VFuOtmrjUBeMTr96A4IH2ozAu6oIDS9cpITOAcUrQsnOHIJF3ubw1hj44rqhnQewDO5O5TGX5E2DHjibQ3ZhvN4C1uAvb9tT/Woblwbkv36xhdvYyMRwew87+YGAdEqKzRC4cni8n8+iPXpk0QnolD1lSP0jEbc2ELLAqUDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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 [207.211.31.120]) by mx.zohomail.com with SMTPS id 1583846698943702.4286590076177; Tue, 10 Mar 2020 06:24:58 -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-257-1hHfU0-8OdajJTNYmfJzQg-1; Tue, 10 Mar 2020 09:24:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6F98189D6C4; Tue, 10 Mar 2020 13:24:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C14491820; Tue, 10 Mar 2020 13:24:48 +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 2F76B86A04; Tue, 10 Mar 2020 13:24:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02ADObip029753 for ; Tue, 10 Mar 2020 09:24:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 489825D9E2; Tue, 10 Mar 2020 13:24:37 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2A9C5D9C5 for ; Tue, 10 Mar 2020 13:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583846697; 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=2h45NHnevKDjvFgHgcCB4jVLdriKNReqn8jDJ+/aNR0=; b=JbrjEc7tctMljCdBk4o12bDS/mG7UxVwIbpiHss6BB8vUa2PHdmsqhx1yPKFEDNAraRZjO 6YP0t2RdpMuZZLEIJiNA6l0M7bAiZnwexzMrWkjs+xZreGyH/uLtvJIG8WcKu5+r5o+R7Y 0Q2QXy8Zp+klAX4iqdCf2EM6r6yA7V8= X-MC-Unique: 1hHfU0-8OdajJTNYmfJzQg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] tools: vsh.c: remove virstrerror.h include Date: Tue, 10 Mar 2020 14:24:29 +0100 Message-Id: <5af6d9420660953990394bb5ff102f71a7db3ad3.1583846630.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This was only used to pull in virStrerror. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tools/vsh.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index 0488295c10..58bb1e6a3c 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -37,7 +37,6 @@ #endif =20 #include "internal.h" -#include "virerror.h" #include "virbuffer.h" #include "viralloc.h" #include "virfile.h" --=20 2.24.1 From nobody Sun May 5 11:42:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1583846702; cv=none; d=zohomail.com; s=zohoarc; b=en1Z1+sazE0FWt3xIQ6lGNeAI9OqpD/eUIJncIytIQOKNEeFXIN8uvlmiJClNadivF2qYEopSMlllTDmwNSwAtdTpGPP3YPnk/spvyT8F8bSbbxM2n8+5CLujnE2hyWJuu+4krYDMlpYSKwhYCLwGwgXW6wSagG9NHyrk33L5a4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583846702; 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=Tgk+7tRKLjnO/DgHmRB/Jb12EoODMf3qDunMUAG+a3M=; b=dAj2BvOdyZBMsb8L9jAvECcM0u4tJGDlN+QXc7AbKdYk+1BPfxPqNuLIspdEpjc7IxATxcWoevvI7g6HOVUYs+k6OF20L+cKulgOz4g9uwUT6OGAjAppSiQuv4HUvDW2lmeu+BZEkIQAiqeFY+sXrOz7X0raWmOv/KjuteivSwM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1583846702976862.5302507905147; Tue, 10 Mar 2020 06:25:02 -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-212-Y6YbU5WzOnq9__9BQ6O2aA-1; Tue, 10 Mar 2020 09:24:58 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2BFEB13F6; Tue, 10 Mar 2020 13:24:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6E2F5C28F; Tue, 10 Mar 2020 13:24:52 +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 7849886A0E; Tue, 10 Mar 2020 13:24:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02ADOcSr029766 for ; Tue, 10 Mar 2020 09:24:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E2085D9E2; Tue, 10 Mar 2020 13:24:38 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9783B5D9C5 for ; Tue, 10 Mar 2020 13:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583846701; 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=Tgk+7tRKLjnO/DgHmRB/Jb12EoODMf3qDunMUAG+a3M=; b=EJU2JsNTrcDuwdc/8HGC03g1AdFilutV3YmTpl8NK0m3YAaG1jwctltn4zLVnY1Jjkm7tn L6qP0SZHHc/4id1VlQLl3Iv16EJn56DNVApR5bLjxvxiGvFk6dIoCb+GCzR5SnQ3JKzZvX hxr+r2mswgHVqATS6h3DOqc7hP9Ar90= X-MC-Unique: Y6YbU5WzOnq9__9BQ6O2aA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] docs: hacking: move virStrerror to removed functions Date: Tue, 10 Mar 2020 14:24:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- docs/hacking.html.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 94c74863b9..1756e84fc4 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -1070,8 +1070,6 @@ BAD: virAsprintfg_strdup_printf virVasprintfg_strdup_vprint use g_vasprintf if you really need to know th= e returned length - virStrerrorg_strerror - the error strings are cached globally so no need to free i= t =20 @@ -1127,6 +1125,7 @@ BAD: ATTRIBUTE_UNUSEDG_GNUC_UNUSED<= /code> VIR_STRDUPg_strdup= VIR_STRNDUPg_strndup + virStrerrorg_strerror =20 =20 --=20 2.24.1