diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index d4807c8b17..43f23a4e5d 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -488,4 +488,12 @@ ErrorOr fork() return pid; } +ErrorOr mkstemp(Span pattern) +{ + int fd = ::mkstemp(pattern.data()); + if (fd < 0) + return Error::from_syscall("mkstemp"sv, -errno); + return fd; +} + } diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index c4b668739a..e9ce8f1d7f 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -65,5 +65,6 @@ ErrorOr isatty(int fd); ErrorOr symlink(StringView target, StringView link_path); ErrorOr mkdir(StringView path, mode_t); ErrorOr fork(); +ErrorOr mkstemp(Span pattern); }