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);
PERROR("fcntl");
goto error_fcntl;
}
- *obj->wait_fd = *waitfd;
+ memcpy(obj->wait_fd, waitfd, sizeof(waitfd));
/* shm_fd: create shm */
obj->memory_map = memory_map;
obj->memory_map_size = memory_map_size;
obj->allocated_len = 0;
+ obj->index = table->allocated_len++;
+
return obj;
error_mmap: