summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-06-22 17:50:51 +0200
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-06-23 20:27:18 +0200
commit39c3919fa6c8f8aa11f3ffe8ba8e0d1a2b819cc6 (patch)
tree4f2ce82b8870d559c3c1971e263bf43cbf527a12 /src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
parent1159a73f374022a2d94fc20372eaed0b6af3d8ed (diff)
Set cloexec in shm buffer
Change-Id: If3d1920fe253d3de43aeef77afeb92f7624c6ba0 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp')
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
index d21a9950a..1ba4caabe 100644
--- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
+++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp
@@ -65,8 +65,14 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
int alloc = stride * size.height();
char filename[] = "/tmp/wayland-shm-XXXXXX";
int fd = mkstemp(filename);
- if (fd < 0)
- qWarning("open %s failed: %s", filename, strerror(errno));
+ if (fd < 0) {
+ qWarning("mkstemp %s failed: %s", filename, strerror(errno));
+ return;
+ }
+ int flags = fcntl(fd, F_GETFD);
+ if (flags != -1)
+ fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+
if (ftruncate(fd, alloc) < 0) {
qWarning("ftruncate failed: %s", strerror(errno));
close(fd);