diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c index 4da027b721..e1863edc4c 100644 --- a/sys/shm/shmpipe.c +++ b/sys/shm/shmpipe.c @@ -235,6 +235,10 @@ sp_writer_create (const char *path, size_t size, mode_t perms) self->socket_path = strdup (sock_un.sun_path); + if (chmod (self->socket_path, perms) < 0) + RETURN_ERROR ("failed to set socket permissions (%d): %s\n", errno, + strerror (errno)); + if (listen (self->main_socket, LISTEN_BACKLOG) < 0) RETURN_ERROR ("listen() failed (%d): %s\n", errno, strerror (errno)); @@ -445,6 +449,8 @@ sp_writer_setperms_shm (ShmPipe * self, mode_t perms) for (area = self->shm_area; area; area = area->next) ret |= fchmod (area->shm_fd, perms); + ret |= chmod (self->socket_path, perms); + return ret; }