{
struct shm_object_table *table = handle->table;
struct shm_object *obj;
+ int wait_fd;
size_t index;
int ret;
if (caa_unlikely(index >= table->allocated_len))
return -EPERM;
obj = &table->objects[index];
- if (obj->wait_fd[0] < 0)
+ wait_fd = obj->wait_fd[0];
+ if (wait_fd < 0)
return -ENOENT;
- ret = close(obj->wait_fd[0]);
+ obj->wait_fd[0] = -1;
+ ret = close(wait_fd);
if (ret) {
ret = -errno;
return ret;
}
- obj->wait_fd[0] = -1;
return 0;
}
{
struct shm_object_table *table = handle->table;
struct shm_object *obj;
+ int wakeup_fd;
size_t index;
int ret;
if (caa_unlikely(index >= table->allocated_len))
return -EPERM;
obj = &table->objects[index];
- if (obj->wait_fd[1] < 0)
+ wakeup_fd = obj->wait_fd[1];
+ if (wakeup_fd < 0)
return -ENOENT;
- ret = close(obj->wait_fd[1]);
+ obj->wait_fd[1] = -1;
+ ret = close(wakeup_fd);
if (ret) {
ret = -errno;
return ret;
}
- obj->wait_fd[1] = -1;
return 0;
}