shmsink: Print errors if fchmod fails

This commit is contained in:
Olivier Crête 2010-06-03 14:22:36 -04:00
parent b9decbb056
commit f26d799676
3 changed files with 17 additions and 6 deletions

View file

@ -195,6 +195,7 @@ gst_shm_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstShmSink *self = GST_SHM_SINK (object);
int ret = 0;
switch (prop_id) {
case PROP_SOCKET_PATH:
@ -206,8 +207,12 @@ gst_shm_sink_set_property (GObject * object, guint prop_id,
case PROP_PERMS:
GST_OBJECT_LOCK (object);
self->perms = g_value_get_uint (value);
sp_writer_setperms_shm (self->pipe, self->perms);
if (self->pipe)
ret = sp_writer_setperms_shm (self->pipe, self->perms);
GST_OBJECT_UNLOCK (object);
if (ret < 0)
GST_WARNING_OBJECT (object, "Could not set permissions on pipe: %s",
strerror (ret));
break;
case PROP_SHM_SIZE:
GST_OBJECT_LOCK (object);
@ -245,8 +250,14 @@ gst_shm_sink_get_property (GObject * object, guint prop_id,
break;
case PROP_PERMS:
self->perms = g_value_get_uint (value);
if (self->pipe)
sp_writer_setperms_shm (self->pipe, self->perms);
if (self->pipe) {
int ret;
ret = sp_writer_setperms_shm (self->pipe, self->perms);
if (ret < 0)
GST_WARNING_OBJECT (object, "Could not set permissions on pipe: %s",
strerror (ret));
}
break;
case PROP_SHM_SIZE:
g_value_set_uint (value, self->size);

View file

@ -371,11 +371,11 @@ sp_close (ShmPipe * self)
spalloc_free (ShmPipe, self);
}
void
int
sp_writer_setperms_shm (ShmPipe * self, mode_t perms)
{
self->perms = perms;
fchmod (self->shm_area->shm_fd, perms);
return fchmod (self->shm_area->shm_fd, perms);
}
static int

View file

@ -50,7 +50,7 @@ ShmPipe *sp_writer_create (const char *path, size_t size, mode_t perms);
const char *sp_writer_get_path (ShmPipe *pipe);
void sp_close (ShmPipe * self);
void sp_writer_setperms_shm (ShmPipe * self, mode_t perms);
int sp_writer_setperms_shm (ShmPipe * self, mode_t perms);
int sp_writer_resize (ShmPipe * self, size_t size);
int sp_get_fd (ShmPipe * self);