mode = data->u.mkdirat.mode;
(void) lttng_directory_handle_init_from_dirfd(&handle, data->fd);
+ /* Ownership of dirfd is transferred to the handle. */
+ data->fd = -1;
/* Safe to call as we have transitioned to the requested uid/gid. */
ret_value->u.mkdirat.ret =
lttng_directory_handle_create_subdirectory_recursive(
mode = data->u.mkdirat.mode;
(void) lttng_directory_handle_init_from_dirfd(&handle, data->fd);
+ /* Ownership of dirfd is transferred to the handle. */
+ data->fd = -1;
/* Safe to call as we have transitioned to the requested uid/gid. */
ret_value->u.mkdirat.ret =
lttng_directory_handle_create_subdirectory(
run_as(dirfd == AT_FDCWD ? RUN_AS_MKDIR : RUN_AS_MKDIRAT,
&data, &run_as_ret, uid, gid);
errno = run_as_ret._errno;
- ret = run_as_ret._errno;
+ ret = run_as_ret.u.mkdirat.ret;
error:
return ret;
}