This flag is not implied by g_mkostemp_full, only by g_mkostemp.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
Reported-by: Bjoern Walk <bwalk(a)linux.ibm.com>
Fixes: 4ac47730408eaf91683f6502ec10541f4f711a5c
---
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 = g_strdup_printf("%s/qemu.screendump.XXXXXX",
cfg->cacheDir)))
goto endjob;
- if ((tmp_fd = g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
+ if ((tmp_fd = g_mkstemp_full(tmp, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"),
tmp);
goto endjob;
}
@@ -11970,7 +11970,7 @@ qemuDomainMemoryPeek(virDomainPtr dom,
goto endjob;
/* Create a temporary filename. */
- if ((fd = g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
+ if ((fd = g_mkstemp_full(tmp, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR)) == -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(virStoragePoolObjPtr pool,
if (!(secretPath = virStoragePoolObjBuildTempFilePath(pool, vol)))
goto cleanup;
- if ((fd = g_mkstemp_full(secretPath, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) {
+ if ((fd = 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
*/
- if ((buffd = g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0)
+ if ((buffd = g_mkstemp_full(path, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0)
return;
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,
tmp = g_strdup_printf("%s/vbox.screendump.XXXXXX", cacheDir);
- if ((tmp_fd = g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
+ if ((tmp_fd = g_mkstemp_full(tmp, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR)) == -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 = 0;
size_t i;
- if ((fd = g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0)
+ if ((fd = g_mkstemp_full(path, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0)
goto error;
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 *doc)
tmpdir = getenv("TMPDIR");
if (!tmpdir) tmpdir = "/tmp";
ret = g_strdup_printf("%s/virshXXXXXX.xml", tmpdir);
- fd = g_mkstemp_full(ret, O_CLOEXEC, S_IRUSR | S_IWUSR);
+ fd = g_mkstemp_full(ret, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR);
if (fd == -1) {
vshError(ctl, _("g_mkstemp_full: failed to create temporary file:
%s"),
virStrerror(errno, ebuf, sizeof(ebuf)));
--
2.21.0