diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index a1565fc22c5..4820882cc45 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -1159,14 +1159,14 @@ ErrorOr mkstemp(Span pattern) return fd; } -ErrorOr mkdtemp(Span pattern) +ErrorOr mkdtemp(Span pattern) { auto* path = ::mkdtemp(pattern.data()); if (path == nullptr) { return Error::from_errno(errno); } - return String::from_utf8(StringView { path, strlen(path) }); + return ByteString { path, strlen(path) }; } ErrorOr rename(StringView old_path, StringView new_path) diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index eeeff8a6799..8e5a6361784 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -185,7 +185,7 @@ ErrorOr chdir(StringView path); ErrorOr rmdir(StringView path); ErrorOr fork(); ErrorOr mkstemp(Span pattern); -ErrorOr mkdtemp(Span pattern); +ErrorOr mkdtemp(Span pattern); ErrorOr fchmod(int fd, mode_t mode); ErrorOr fchown(int fd, uid_t, gid_t); ErrorOr rename(StringView old_path, StringView new_path); diff --git a/Userland/Libraries/LibFileSystem/TempFile.cpp b/Userland/Libraries/LibFileSystem/TempFile.cpp index 91e7cb139c3..42d324d9257 100644 --- a/Userland/Libraries/LibFileSystem/TempFile.cpp +++ b/Userland/Libraries/LibFileSystem/TempFile.cpp @@ -28,7 +28,8 @@ ErrorOr> TempFile::create_temp_directory() char pattern[] = "/tmp/tmp.XXXXXX"; auto path = TRY(Core::System::mkdtemp(pattern)); - return adopt_nonnull_own_or_enomem(new (nothrow) TempFile(Type::Directory, path)); + auto string = TRY(String::from_byte_string(path)); + return adopt_nonnull_own_or_enomem(new (nothrow) TempFile(Type::Directory, string)); } ErrorOr> TempFile::create_temp_file() diff --git a/Userland/Utilities/runc/main.cpp b/Userland/Utilities/runc/main.cpp index aa986dd8f2f..56176b4304f 100644 --- a/Userland/Utilities/runc/main.cpp +++ b/Userland/Utilities/runc/main.cpp @@ -23,12 +23,12 @@ static ErrorOr create_custom_vfs_root_context_layout(JsonArray const& layo char pattern[] = "/tmp/container_root_XXXXXX"; auto temp_directory_path = TRY(Core::System::mkdtemp(pattern)); TRY(LayoutParsing::create_root_mount_point(temp_directory_path, layout_creation_sequence)); - auto vfs_root_context_layout = TRY(VFSRootContextLayout::create_with_root_mount_point(temp_directory_path.bytes_as_string_view())); + auto vfs_root_context_layout = TRY(VFSRootContextLayout::create_with_root_mount_point(temp_directory_path)); TRY(LayoutParsing::handle_creation_sequence(*vfs_root_context_layout, layout_creation_sequence)); TRY(vfs_root_context_layout->apply_mounts_on_vfs_root_context_id()); - TRY(Core::System::umount({}, temp_directory_path.bytes_as_string_view())); + TRY(Core::System::umount({}, temp_directory_path)); TRY(Core::System::rmdir(temp_directory_path));