aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2019-11-21 03:02:08 +0000
committerBrian Ashworth <bosrsf04@gmail.com>2019-11-20 22:19:48 -0500
commitd0479cc2bc0337b5d9458647bf4e2dad218c5cff (patch)
tree1c3cab25b19471c39c8cfbc1a0e7c43f4ea48afa /examples
parent16e5e9541b3de49e397a3d2caa3212db25487648 (diff)
examples: set mode when creating shm object
$ screencopy shm_open failed failed to create buffer $ posixshmcontrol ls MODE OWNER GROUP SIZE PATH --------- foo foo 33177600 /wlroots-screencopy
Diffstat (limited to 'examples')
-rw-r--r--examples/screencopy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/screencopy.c b/examples/screencopy.c
index 82edcb9c..28ad7f06 100644
--- a/examples/screencopy.c
+++ b/examples/screencopy.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <wayland-client-protocol.h>
@@ -69,7 +70,7 @@ static struct wl_buffer *create_shm_buffer(enum wl_shm_format fmt,
int size = stride * height;
const char shm_name[] = "/wlroots-screencopy";
- int fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0);
+ int fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
if (fd < 0) {
fprintf(stderr, "shm_open failed\n");
return NULL;