shm: apply shm area permissions to shmpipe control socket

Apply shared memory area permissions to the control socket (more
precisely, the path it is bound to) as well.

https://bugzilla.gnome.org/show_bug.cgi?id=682775
This commit is contained in:
Roland Elek 2013-01-07 13:32:06 +01:00 committed by Olivier Crête
parent 49fefbde65
commit 2cacfa2932

View file

@ -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;
}