diff options
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.h | 1 |
2 files changed, 9 insertions, 0 deletions
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<pid_t> fork() return pid; } +ErrorOr<int> mkstemp(Span<char> 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<bool> isatty(int fd); ErrorOr<void> symlink(StringView target, StringView link_path); ErrorOr<void> mkdir(StringView path, mode_t); ErrorOr<pid_t> fork(); +ErrorOr<int> mkstemp(Span<char> pattern); } |