From nobody Mon Apr 29 16:33:37 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=1574095808; cv=none; d=zoho.com; s=zohoarc; b=m4uoa8zrja5J44B6e1KtDeTDPc9fwXRDKRxkburCGfaibNMyuNOYFx7588FWglVcKbV3yZOAzwHDTpWkuQtPAcToFd5VyoXPXZMxgn3o7jgRs6mVKzYWhKQb1H7QG7iBUOZmGqKNS1FKURxWTwZ/JGLJT4jdsQakY4SMoKNJhq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574095808; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=fimwFWn3tbzFgRacvT/7qi51CsKNBZUSAUKaQLJ69ho=; b=mDT6zRvsbYwMKyiDs2BttFulV4oCX2RMXRkAllCmnIurzRBuFMvzzeWgKIQEsuxABYQq0w88qwNGWb+Jsoxls+ruU+aI5qZr9oKOZjzuxkcXThwmk6nz5e97U6ZL1jV2V6dem32kuA5CLQmL07O6AKAkwtZ9iATECf43yCG/KVg= 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 1574095808017970.7451035379661; Mon, 18 Nov 2019 08:50:08 -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-157-c_WN36nzN6WjeZmyaJZ0nw-1; Mon, 18 Nov 2019 11:48:47 -0500 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 D31558E7DD4; Mon, 18 Nov 2019 16:48: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 D12DB46E8E; Mon, 18 Nov 2019 16:48: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 94CE11802228; Mon, 18 Nov 2019 16:48:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAIGmZGp025376 for ; Mon, 18 Nov 2019 11:48:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 324B51C3; Mon, 18 Nov 2019 16:48:35 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0146643E4 for ; Mon, 18 Nov 2019 16:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574095805; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fimwFWn3tbzFgRacvT/7qi51CsKNBZUSAUKaQLJ69ho=; b=f5d/9RIygaHzx6Br6QL55M1pwjd49oWztlZH+7WJoXfOeC0vRpM6CDyHGj877uT0GpiUSi FgJ3+I054w1XlU0+6ss15egH2UUM1/vwRKacIb2Ck5i1HmR2n1LAql3olYE2ggkoF2Pu6W nTk8d0JAYamfRNlwWDDeVQMs4CMwnqc= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 18 Nov 2019 17:49:25 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] g_mkostemp_full: pass O_RDWR 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-MC-Unique: c_WN36nzN6WjeZmyaJZ0nw-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" This flag is not implied by g_mkostemp_full, only by g_mkostemp. Signed-off-by: J=C3=A1n Tomko Reported-by: Bjoern Walk Fixes: 4ac47730408eaf91683f6502ec10541f4f711a5c Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 4 ++-- src/storage/storage_util.c | 2 +- src/util/virlog.c | 2 +- src/vbox/vbox_common.c | 2 +- tests/virfiletest.c | 2 +- tools/vsh.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 60f5732708..7fd87a9d76 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4024,7 +4024,7 @@ qemuDomainScreenshot(virDomainPtr dom, if (!(tmp =3D g_strdup_printf("%s/qemu.screendump.XXXXXX", cfg->cacheD= ir))) goto endjob; =20 - if ((tmp_fd =3D g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) =3D= =3D -1) { + if ((tmp_fd =3D g_mkstemp_full(tmp, O_RDWR | O_CLOEXEC, S_IRUSR | S_IW= USR)) =3D=3D -1) { virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp); goto endjob; } @@ -11970,7 +11970,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto endjob; =20 /* Create a temporary filename. */ - if ((fd =3D g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) =3D=3D = -1) { + if ((fd =3D g_mkstemp_full(tmp, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR)= ) =3D=3D -1) { virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp); goto endjob; diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 6d41df8d7e..f2d8810813 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1215,7 +1215,7 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolO= bjPtr pool, if (!(secretPath =3D virStoragePoolObjBuildTempFilePath(pool, vol))) goto cleanup; =20 - if ((fd =3D g_mkstemp_full(secretPath, O_CLOEXEC, S_IRUSR | S_IWUSR)) = < 0) { + if ((fd =3D g_mkstemp_full(secretPath, O_RDWR | 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 05052e9d09..d45e2dd316 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -992,7 +992,7 @@ virLogOutputToJournald(virLogSourcePtr source, * and pass an FD to the journal */ =20 - if ((buffd =3D g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) + if ((buffd =3D g_mkstemp_full(path, O_RDWR | O_CLOEXEC, S_IRUSR | S_IW= USR)) < 0) return; =20 if (unlink(path) < 0) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 88ef41b5df..9e41b6767a 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -7385,7 +7385,7 @@ vboxDomainScreenshot(virDomainPtr dom, =20 tmp =3D g_strdup_printf("%s/vbox.screendump.XXXXXX", cacheDir); =20 - if ((tmp_fd =3D g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) =3D= =3D -1) { + if ((tmp_fd =3D g_mkstemp_full(tmp, O_RDWR | O_CLOEXEC, S_IRUSR | S_IW= USR)) =3D=3D -1) { virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp); VIR_FREE(tmp); VBOX_RELEASE(machine); diff --git a/tests/virfiletest.c b/tests/virfiletest.c index 193c5bedd4..781c640e2b 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 g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) + if ((fd =3D g_mkstemp_full(path, O_RDWR | 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 b5de06f26b..1076c8254b 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2400,7 +2400,7 @@ 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 g_mkstemp_full(ret, O_CLOEXEC, S_IRUSR | S_IWUSR); + 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))); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list