[evince/gnome-3-30] libdocument: Fix ev_mkstemp
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-30] libdocument: Fix ev_mkstemp
- Date: Sat, 29 Sep 2018 20:16:56 +0000 (UTC)
commit 206155b6e7551e49b03e5d40393691fb084cc009
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]