{
int ret;
struct lttng_directory_handle handle;
- struct lttng_credentials creds = {
+ const struct lttng_credentials creds = {
.uid = (uid_t) uid,
.gid = (gid_t) gid,
};
- (void) lttng_directory_handle_init(&handle, NULL);
+ ret = lttng_directory_handle_init(&handle, NULL);
+ if (ret) {
+ goto end;
+ }
ret = lttng_directory_handle_create_subdirectory_as_user(
&handle, path, mode,
(uid >= 0 || gid >= 0) ? &creds : NULL);
lttng_directory_handle_fini(&handle);
+end:
return ret;
}
{
int ret;
struct lttng_directory_handle handle;
- struct lttng_credentials creds = {
+ const struct lttng_credentials creds = {
.uid = (uid_t) uid,
.gid = (gid_t) gid,
};
- (void) lttng_directory_handle_init(&handle, NULL);
+ ret = lttng_directory_handle_init(&handle, NULL);
+ if (ret) {
+ goto end;
+ }
ret = lttng_directory_handle_create_subdirectory_recursive_as_user(
&handle, path, mode,
(uid >= 0 || gid >= 0) ? &creds : NULL);
lttng_directory_handle_fini(&handle);
+end:
return ret;
}