[evince/wip/chpe/issue-988: 1/2] libdocument: Fix ev_mkstemp
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/chpe/issue-988: 1/2] libdocument: Fix ev_mkstemp
- Date: Tue, 25 Sep 2018 18:38:18 +0000 (UTC)
commit 27e6f360be61e57a6bc29038eb644b13cd33778f
Author: Christian Persch <chpe src gnome org>
Date: Tue Sep 25 20:34:04 2018 +0200
libdocument: Fix ev_mkstemp
Add missing O_RDWR flag.
https://gitlab.gnome.org/GNOME/evince/issues/988
libdocument/ev-file-helpers.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index c9de2f83..07f8f2c7 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -20,6 +20,7 @@
#include <config.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
@@ -34,6 +35,10 @@
static gchar *tmp_dir = NULL;
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
/*
* ev_dir_ensure_exists:
* @dir: the directory name
@@ -139,7 +144,7 @@ ev_mkstemp (const char *tmpl,
return -1;
name = g_build_filename (tmp, tmpl, NULL);
- fd = g_mkstemp_full (name, O_CLOEXEC, 0600);
+ fd = g_mkstemp_full (name, O_RDWR | O_BINARY | O_CLOEXEC, 0600);
if (fd == -1) {
int errsv = errno;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]