adding O_RDWR flag in the open()
authorJiayuan Ren <renjiayuan1314@gmail.com>
Thu, 24 Oct 2019 22:31:56 +0000 (22:31 +0000)
committerSimon Ser <contact@emersion.fr>
Thu, 24 Oct 2019 22:31:56 +0000 (22:31 +0000)
According to the manual of open:
"The argument flags must include one of the following access modes:
O_RDONLY, O_WRONLY, or O_RDWR."

src/wayland-server.c

index c4c52ed..5f466a0 100644 (file)
@@ -1435,7 +1435,7 @@ wl_socket_lock(struct wl_socket *socket)
        snprintf(socket->lock_addr, sizeof socket->lock_addr,
                 "%s%s", socket->addr.sun_path, LOCK_SUFFIX);
 
-       socket->fd_lock = open(socket->lock_addr, O_CREAT | O_CLOEXEC,
+       socket->fd_lock = open(socket->lock_addr, O_CREAT | O_CLOEXEC | O_RDWR,
                               (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
 
        if (socket->fd_lock < 0) {