g_mkstemp_full: pass O_RDWR

This flag is not implied by g_mkstemp_full, only by g_mkstemp.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Bjoern Walk <bwalk@linux.ibm.com>
Fixes: 4ac4773040
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Ján Tomko 2019-11-18 17:45:54 +01:00
parent 7909359d60
commit af5aa266ed
6 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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)));