From 2e52de5744a437a85463860efb5c04eaecb19770 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 15 Jan 2023 19:34:01 -0500 Subject: [PATCH] LibCore: Add `Stream::File::fd()` Unlike `leak_fd()` the stream is still owning the file descriptor after the call. --- Userland/Libraries/LibCore/Stream.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibCore/Stream.h b/Userland/Libraries/LibCore/Stream.h index 4ed9ce5c21..d00fc00f9d 100644 --- a/Userland/Libraries/LibCore/Stream.h +++ b/Userland/Libraries/LibCore/Stream.h @@ -322,6 +322,11 @@ public: return m_fd; } + int fd() const + { + return m_fd; + } + virtual ~File() override { if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes)