From nobody Tue May 7 14:45:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573739257; cv=none; d=zoho.com; s=zohoarc; b=VsOzZdMF8FKFHW0yPArpUYTixYE/QWSvAq2xiMvqLRnSOMu+yu8fwwzUL5JB8iQ0tDOqlmN0mNn3C3vN6CgRAhYHlvl4CW3kOj5e2aN1AUG2SQYHW43Kz/sI2gAoUYkpbKBehjEbow0HGcqTM6Uv33o2LO47uMdTBMU/Esym/ZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573739257; 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=ZU2wBU3LnwBzqpgtDb56eNmR4jkCx4QReJ69EegTnvc=; b=Pzxjru3uw0RAMzW2kIKuiRkOUhpp9sV6jxdUwYfZS8gu1Zfhh1KLf5OxUBlwYeZJZ3S9Ej7RsXEGe12q6lQPqIsFJUclf/mQtbKhUjR2J1NnCEcgFkY6hw6Z+6BmChAO+WJkDm1KzxFf3D4S+ugroXk/GKwLuHkZk4HB0qhmNv8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1573739257887223.56783659584778; Thu, 14 Nov 2019 05:47:37 -0800 (PST) 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-63-0paCkIAZNLKdMXmAievPvw-1; Thu, 14 Nov 2019 08:47:34 -0500 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 7CC3C800052; Thu, 14 Nov 2019 13:47:28 +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 5710781E08; Thu, 14 Nov 2019 13:47:28 +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 10E8718005A9; Thu, 14 Nov 2019 13:47:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEDlD0W018321 for ; Thu, 14 Nov 2019 08:47:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id E4001472E4; Thu, 14 Nov 2019 13:47:13 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D3FC2936C for ; Thu, 14 Nov 2019 13:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573739256; 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=ZU2wBU3LnwBzqpgtDb56eNmR4jkCx4QReJ69EegTnvc=; b=cWEQC2/u4RfXsID7cOdsoX9TPBTU1X5YMS77ukRu34llmZKyHexHYdSzHoarDXJv80kD76 Z9fl2E+CRAHudhW+459SukHc7OJ64vPDdHMq7Pa7pXodkOHs65WhECSLxc96h52sBNJmML vvKp+MrKmmTNuQpGFwM53wVZ2pCvYRg= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 14:48:04 +0100 Message-Id: <33219a91032afc35aa949a239d171ceaffd2dc62.1573739122.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] Use g_mkstemp_full instead of mkostemp(s) 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: 0paCkIAZNLKdMXmAievPvw-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" With g_mkstemp_full, there is no need to distinguish between mkostemp and mkostemps (no suffix vs. a suffix of a fixed length), because the GLib function looks for the XXXXXX pattern everywhere in the string. Use S_IRUSR | S_IWUSR for the permissions and do not pass O_RDWR in flags since it's implied. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 8 ++++---- src/storage/storage_driver.c | 2 +- src/storage/storage_util.c | 2 +- src/util/virlog.c | 8 +------- src/vbox/vbox_common.c | 4 ++-- tests/virfiletest.c | 2 +- tools/vsh.c | 4 ++-- 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 159a6dc464..a9364dc7e3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4024,8 +4024,8 @@ qemuDomainScreenshot(virDomainPtr dom, if (!(tmp =3D g_strdup_printf("%s/qemu.screendump.XXXXXX", cfg->cacheD= ir))) goto endjob; =20 - if ((tmp_fd =3D mkostemp(tmp, O_CLOEXEC)) =3D=3D -1) { - virReportSystemError(errno, _("mkostemp(\"%s\") failed"), tmp); + if ((tmp_fd =3D g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) =3D= =3D -1) { + virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp); goto endjob; } unlink_tmp =3D true; @@ -11963,9 +11963,9 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto endjob; =20 /* Create a temporary filename. */ - if ((fd =3D mkostemp(tmp, O_CLOEXEC)) =3D=3D -1) { + if ((fd =3D g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) =3D=3D = -1) { virReportSystemError(errno, - _("mkostemp(\"%s\") failed"), tmp); + _("g_mkstemp(\"%s\") failed"), tmp); goto endjob; } =20 diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 04e4abcd6a..d8355d3c3c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -2825,7 +2825,7 @@ virStoragePoolObjFindPoolByUUID(const unsigned char *= uuid) * * Generate a name for a temporary file using the driver stateDir * as a path, the pool name, and the volume name to be used as input - * for a mkostemp + * for mkstemp * * Returns a string pointer on success, NULL on failure */ diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index f91c2c64ee..8cc308e12d 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1216,7 +1216,7 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolO= bjPtr pool, if (!(secretPath =3D virStoragePoolObjBuildTempFilePath(pool, vol))) goto cleanup; =20 - if ((fd =3D mkostemp(secretPath, O_CLOEXEC)) < 0) { + if ((fd =3D g_mkstemp_full(secretPath, O_CLOEXEC, S_IRUSR | S_IWUSR)) = < 0) { virReportSystemError(errno, "%s", _("failed to open secret file for write")); goto error; diff --git a/src/util/virlog.c b/src/util/virlog.c index b3460d85fe..dcb287f146 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -996,13 +996,7 @@ virLogOutputToJournald(virLogSourcePtr source, * and pass an FD to the journal */ =20 - /* NB: mkostemp is not declared async signal safe by - * POSIX, but this is Linux only code and the GLibc - * impl is safe enough, only using open() and inline - * asm to read a timestamp (falling back to gettimeofday - * on some arches - */ - if ((buffd =3D mkostemp(path, O_CLOEXEC|O_RDWR)) < 0) + if ((buffd =3D g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) return; =20 if (unlink(path) < 0) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 0bd47e3ddb..043c26b9f6 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -7385,8 +7385,8 @@ vboxDomainScreenshot(virDomainPtr dom, =20 tmp =3D g_strdup_printf("%s/vbox.screendump.XXXXXX", cacheDir); =20 - if ((tmp_fd =3D mkostemp(tmp, O_CLOEXEC)) =3D=3D -1) { - virReportSystemError(errno, _("mkostemp(\"%s\") failed"), tmp); + if ((tmp_fd =3D g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) =3D= =3D -1) { + virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp); VIR_FREE(tmp); VBOX_RELEASE(machine); return NULL; diff --git a/tests/virfiletest.c b/tests/virfiletest.c index c7d5f6abeb..193c5bedd4 100644 --- a/tests/virfiletest.c +++ b/tests/virfiletest.c @@ -133,7 +133,7 @@ makeSparseFile(const off_t offsets[], off_t len =3D 0; size_t i; =20 - if ((fd =3D mkostemp(path, O_CLOEXEC|O_RDWR)) < 0) + if ((fd =3D g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) goto error; =20 if (unlink(path) < 0) diff --git a/tools/vsh.c b/tools/vsh.c index 000cf6a009..e851303e69 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2400,9 +2400,9 @@ vshEditWriteToTempFile(vshControl *ctl, const char *d= oc) tmpdir =3D getenv("TMPDIR"); if (!tmpdir) tmpdir =3D "/tmp"; ret =3D g_strdup_printf("%s/virshXXXXXX.xml", tmpdir); - fd =3D mkostemps(ret, 4, O_CLOEXEC); + fd =3D g_mkstemp_full(ret, O_CLOEXEC, S_IRUSR | S_IWUSR); if (fd =3D=3D -1) { - vshError(ctl, _("mkostemps: failed to create temporary file: %s"), + vshError(ctl, _("g_mkstemp: failed to create temporary file: %s"), virStrerror(errno, ebuf, sizeof(ebuf))); VIR_FREE(ret); return NULL; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 14:45:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573739247; cv=none; d=zoho.com; s=zohoarc; b=RndvvWvLHR1st5s/Z26psqTUraUJvyM0l9w4FDRqb2h08rKQbuO8dJut8VrY3jgvRmxSJ/K5FIZNRr1/UjM+oN5GvIHRQ2yElHaAfulfcJSYjzrh5IdWk+fkX+kssFVANO2sJIuZWDOoFHmfZWoclPSnwz9JASJFK8T3yVp4BUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573739247; 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=TKONW1enOfjhlALkfVSUUUGKQ/s6zfD6FDaNaFgapas=; b=IywjdzW5JWtxiHP/OuaEzeS7zT3p6ePqPrZuZXf3ujIuC7VlHX+BUp6lToixASaSL+rLPEHq5RH26+aYxS47MP4OaKqKa1ui8NAmzoUxRon7etRWWeukP+mdLPYZPwkiSO27Kkv5ruA5AUK/WcuZwfG541oCe+JGoRnR4FYnWTw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573739247062994.9909455397836; Thu, 14 Nov 2019 05:47:27 -0800 (PST) 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-364-dzMpTmVfOsiR7i4o9urGGQ-1; Thu, 14 Nov 2019 08:47:23 -0500 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 E34AE1005502; Thu, 14 Nov 2019 13:47:18 +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 A27D781E2D; Thu, 14 Nov 2019 13:47:18 +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 516A1181A2EC; Thu, 14 Nov 2019 13:47:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEDlHEg018340 for ; Thu, 14 Nov 2019 08:47:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5E0892936C; Thu, 14 Nov 2019 13:47:17 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC0532A167 for ; Thu, 14 Nov 2019 13:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573739245; 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=TKONW1enOfjhlALkfVSUUUGKQ/s6zfD6FDaNaFgapas=; b=DlyDpAkI/wqk+edFHwVCnpUXqIFeWwUemYJYijEOi4ebTtj7g0Vc+uo10xzwRTH3x4JGVh lnKK/wNjQON3breDGqHqEcX+A/OAGPqWJiWJkbsMUs9to/8k5PiAHJybGWhfNWVeWGt8or pNVukW6OupFSkrZvzj30qXO8Hg3jc1U= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 14:48:05 +0100 Message-Id: <814ac6050621a1401bd70b73dcedf7a68d6e130b.1573739122.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] Use g_mkdtemp instead of mkdtemp 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: dzMpTmVfOsiR7i4o9urGGQ-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" Prefer the GLib version to the one from gnulib. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_process.c | 2 +- tests/fdstreamtest.c | 2 +- tests/qemuhotplugtest.c | 2 +- tests/qemumemlocktest.c | 2 +- tests/qemumonitortestutils.c | 2 +- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 2 +- tests/scsihosttest.c | 2 +- tests/testutilsqemu.c | 4 ++-- tests/vircgrouptest.c | 2 +- tests/virhostdevtest.c | 2 +- tests/virnetsockettest.c | 4 ++-- tests/virpcitest.c | 2 +- tests/virscsitest.c | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 4cf4069d50..a669fc608f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8508,7 +8508,7 @@ qemuProcessQMPInit(qemuProcessQMPPtr proc) =20 template =3D g_strdup_printf("%s/qmp-XXXXXX", proc->libDir); =20 - if (!(proc->uniqDir =3D mkdtemp(template))) { + if (!(proc->uniqDir =3D g_mkdtemp(template))) { virReportSystemError(errno, _("Failed to create unique directory with " "template '%s' for probing QEMU"), diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c index f4d38d5a20..03f5520fa6 100644 --- a/tests/fdstreamtest.c +++ b/tests/fdstreamtest.c @@ -319,7 +319,7 @@ mymain(void) char scratchdir[] =3D SCRATCHDIRTEMPLATE; int ret =3D 0; =20 - if (!mkdtemp(scratchdir)) { + if (!g_mkdtemp(scratchdir)) { virFilePrintf(stderr, "Cannot create fdstreamdir"); abort(); } diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index a0a579f29a..5356785fa4 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -593,7 +593,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c index d5a4fb1268..52cd9f9f26 100644 --- a/tests/qemumemlocktest.c +++ b/tests/qemumemlocktest.c @@ -62,7 +62,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index d7ecdb2ef9..617a2997d1 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1045,7 +1045,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt, =20 tmpdir_template =3D g_strdup("/tmp/libvirt_XXXXXX"); =20 - if (!(test->tmpdir =3D mkdtemp(tmpdir_template))) { + if (!(test->tmpdir =3D g_mkdtemp(tmpdir_template))) { virReportSystemError(errno, "%s", "Failed to create temporary directory"); goto error; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f0405866e1..5e1d6a45c5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -609,7 +609,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 8b256b9b19..08c85d3b73 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -142,7 +142,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } diff --git a/tests/scsihosttest.c b/tests/scsihosttest.c index b35ec6980a..e8193836ff 100644 --- a/tests/scsihosttest.c +++ b/tests/scsihosttest.c @@ -250,7 +250,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); goto cleanup; } diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 6fe385e545..5a7011478b 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -709,14 +709,14 @@ int qemuTestDriverInit(virQEMUDriver *driver) driver->config->libDir =3D g_strdup("/tmp/lib"); driver->config->channelTargetDir =3D g_strdup("/tmp/channel"); =20 - if (!mkdtemp(statedir)) { + if (!g_mkdtemp(statedir)) { virFilePrintf(stderr, "Cannot create fake stateDir"); goto error; } =20 driver->config->stateDir =3D g_strdup(statedir); =20 - if (!mkdtemp(configdir)) { + if (!g_mkdtemp(configdir)) { virFilePrintf(stderr, "Cannot create fake configDir"); goto error; } diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index e1770426d7..c952676c25 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -989,7 +989,7 @@ initFakeFS(const char *mode, =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 1f3f730433..ed8e7e8fc1 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -502,7 +502,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { fprintf(stderr, "Cannot create fakerootdir"); abort(); } diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index 4e9f201e45..3a5959b27e 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -191,7 +191,7 @@ testSocketAccept(const void *opaque) =20 if (!data) { virNetSocketPtr usock; - tmpdir =3D mkdtemp(template); + tmpdir =3D g_mkdtemp(template); if (tmpdir =3D=3D NULL) { VIR_WARN("Failed to create temporary directory"); goto cleanup; @@ -315,7 +315,7 @@ static int testSocketUNIXAddrs(const void *data G_GNUC_= UNUSED) char *tmpdir; char template[] =3D "/tmp/libvirt_XXXXXX"; =20 - tmpdir =3D mkdtemp(template); + tmpdir =3D g_mkdtemp(template); if (tmpdir =3D=3D NULL) { VIR_WARN("Failed to create temporary directory"); goto cleanup; diff --git a/tests/virpcitest.c b/tests/virpcitest.c index d6dbe8c1ef..21dd538232 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -330,7 +330,7 @@ mymain(void) =20 fakerootdir =3D g_strdup(FAKEROOTDIRTEMPLATE); =20 - if (!mkdtemp(fakerootdir)) { + if (!g_mkdtemp(fakerootdir)) { VIR_TEST_DEBUG("Cannot create fakerootdir"); abort(); } diff --git a/tests/virscsitest.c b/tests/virscsitest.c index 4d40f2bb82..d5a0da4753 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -194,7 +194,7 @@ mymain(void) =20 virscsi_prefix =3D g_strdup_printf("%s" VIR_SCSI_DATA, abs_srcdir); =20 - tmpdir =3D mkdtemp(template); + tmpdir =3D g_mkdtemp(template); =20 if (tmpdir =3D=3D NULL) { VIR_WARN("Failed to create temporary directory"); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue May 7 14:45:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573739262; cv=none; d=zoho.com; s=zohoarc; b=EOqT0uN1wjBpRlmdj6weeMD6iLTi2Jy4gfKpQ27I1iNZhUAChONk8kTatYjMr+c2yc7q0Jj8UsgGGRRwykd4h6j26HmnEwwoEv9dJlnWrKpt1lK2QsQ7mKYnnIIFAWAxn0Gt4Oh/KE7LFLjauvT5x/vutDXCnBZKl7CjTiNVvxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573739262; 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=Sb4zYJ+kU7lNabdD83sntqlXaH098mX4sIjFYlkl/lg=; b=RU0zlknDMH2D4dPiO9HAKeGyRFk1k+i4lBFnHBDeG0NqP+wBbaF/anuZZ5sFFWniJhOr2kNGiMA3mdF2lhX21ruA8jLiIfGNlYXDfYVS7UGjDORBWU4ZbWD/jxkvlSzJtwPXHdBGasiaG3RFDu1kSMJRPKJ0Pp6CfRmvDwr7cuA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1573739262942249.66993605245978; Thu, 14 Nov 2019 05:47:42 -0800 (PST) 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-235-C6owIkVKNIqdchinLVLy5Q-1; Thu, 14 Nov 2019 08:47:39 -0500 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 813391802CE8; Thu, 14 Nov 2019 13:47:33 +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 584FA5C1D4; Thu, 14 Nov 2019 13:47:33 +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 1769418218AA; Thu, 14 Nov 2019 13:47:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEDlIAx018346 for ; Thu, 14 Nov 2019 08:47:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2AB6D2A167; Thu, 14 Nov 2019 13:47:18 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA42D2936C for ; Thu, 14 Nov 2019 13:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573739261; 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=Sb4zYJ+kU7lNabdD83sntqlXaH098mX4sIjFYlkl/lg=; b=U7Zm5w4O+BO4SVDpWUG0KILwBBi+NAWwioVYXeuRtU1EPLvgJ0qwokE11kM6pAbxRT62io auocSjgHFeXhjEfiaiaTo9kk/LXyQNeSISlkS1z7uiJKgBLjTo1xy16Qi9S6Q9wqaABXJp 5WWm80s60PW789kW1rWUyVq+gfMuFSE= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 14 Nov 2019 14:48:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] syntax-check: prefer g_mkstemp_full and g_mkdtemp 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-MC-Unique: C6owIkVKNIqdchinLVLy5Q-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" Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- build-aux/syntax-check.mk | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 74d0d5f6d4..7d1ac4dbfc 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -402,10 +402,17 @@ sc_prohibit_fork_wrappers: halt=3D'use virCommand for child processes' \ $(_sc_search_regexp) =20 -# Prefer mkostemp with O_CLOEXEC. +# Prefer g_mkostemp_full with O_CLOEXEC. sc_prohibit_mkstemp: - @prohibit=3D'[^"]\