From: Mathieu Desnoyers Date: Tue, 23 Aug 2011 18:36:16 +0000 (-0400) Subject: fix shm objects wait fd and allocation error handling X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7a9c21bd702ae4d54d8c1f623e9837e0248b0643;p=ust.git fix shm objects wait fd and allocation error handling Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/shm.c b/libringbuffer/shm.c index 6a77af6..86e8d91 100644 --- a/libringbuffer/shm.c +++ b/libringbuffer/shm.c @@ -34,7 +34,7 @@ struct shm_object *shm_object_table_append(struct shm_object_table *table, if (table->allocated_len >= table->size) return NULL; - obj = &table->objects[table->allocated_len++]; + obj = &table->objects[table->allocated_len]; /* wait_fd: create pipe */ ret = pipe(waitfd); @@ -55,7 +55,7 @@ struct shm_object *shm_object_table_append(struct shm_object_table *table, PERROR("fcntl"); goto error_fcntl; } - *obj->wait_fd = *waitfd; + memcpy(obj->wait_fd, waitfd, sizeof(waitfd)); /* shm_fd: create shm */ @@ -98,6 +98,8 @@ struct shm_object *shm_object_table_append(struct shm_object_table *table, obj->memory_map = memory_map; obj->memory_map_size = memory_map_size; obj->allocated_len = 0; + + table->allocated_len++; return obj; error_mmap: