const struct lttng_directory_handle *ref_handle)
{
int dirfd;
- struct lttng_directory_handle *handle = NULL;
+ struct lttng_directory_handle *handle = nullptr;
if (!path) {
handle = lttng_directory_handle_copy(ref_handle);
if (close(dirfd)) {
PERROR("Failed to close directory file descriptor");
}
- return NULL;
+ return nullptr;
}
struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(int dirfd)
if (ret) {
PERROR("Failed to fstat directory file descriptor %i", dirfd);
lttng_directory_handle_release(&handle->ref);
- handle = NULL;
+ handle = nullptr;
goto end;
}
} else {
struct lttng_directory_handle *
lttng_directory_handle_copy(const struct lttng_directory_handle *handle)
{
- struct lttng_directory_handle *new_handle = NULL;
+ struct lttng_directory_handle *new_handle = nullptr;
if (handle->dirfd == AT_FDCWD) {
new_handle = lttng_directory_handle_create_from_dirfd(AT_FDCWD);
static DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *handle,
const char *path)
{
- DIR *dir_stream = NULL;
+ DIR *dir_stream = nullptr;
int fd = openat(handle->dirfd, path, O_RDONLY);
if (fd < 0) {
const char *subdirectory,
mode_t mode)
{
- return lttng_directory_handle_create_subdirectory_as_user(handle, subdirectory, mode, NULL);
+ return lttng_directory_handle_create_subdirectory_as_user(
+ handle, subdirectory, mode, nullptr);
}
int lttng_directory_handle_create_subdirectory_recursive(
const struct lttng_directory_handle *handle, const char *subdirectory_path, mode_t mode)
{
return lttng_directory_handle_create_subdirectory_recursive_as_user(
- handle, subdirectory_path, mode, NULL);
+ handle, subdirectory_path, mode, nullptr);
}
int lttng_directory_handle_open_file_as_user(const struct lttng_directory_handle *handle,
int flags,
mode_t mode)
{
- return lttng_directory_handle_open_file_as_user(handle, filename, flags, mode, NULL);
+ return lttng_directory_handle_open_file_as_user(handle, filename, flags, mode, nullptr);
}
int lttng_directory_handle_unlink_file_as_user(const struct lttng_directory_handle *handle,
int lttng_directory_handle_unlink_file(const struct lttng_directory_handle *handle,
const char *filename)
{
- return lttng_directory_handle_unlink_file_as_user(handle, filename, NULL);
+ return lttng_directory_handle_unlink_file_as_user(handle, filename, nullptr);
}
int lttng_directory_handle_rename(const struct lttng_directory_handle *old_handle,
const char *new_name)
{
return lttng_directory_handle_rename_as_user(
- old_handle, old_name, new_handle, new_name, NULL);
+ old_handle, old_name, new_handle, new_name, nullptr);
}
int lttng_directory_handle_rename_as_user(const struct lttng_directory_handle *old_handle,
int lttng_directory_handle_remove_subdirectory(const struct lttng_directory_handle *handle,
const char *name)
{
- return lttng_directory_handle_remove_subdirectory_as_user(handle, name, NULL);
+ return lttng_directory_handle_remove_subdirectory_as_user(handle, name, nullptr);
}
int lttng_directory_handle_remove_subdirectory_as_user(const struct lttng_directory_handle *handle,
const struct lttng_directory_handle *handle, const char *name, int flags)
{
return lttng_directory_handle_remove_subdirectory_recursive_as_user(
- handle, name, NULL, flags);
+ handle, name, nullptr, flags);
}
int lttng_directory_handle_remove_subdirectory_recursive_as_user(