diff options
Diffstat (limited to 'src/fs/virtfileprivate.cpp')
-rw-r--r-- | src/fs/virtfileprivate.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/fs/virtfileprivate.cpp b/src/fs/virtfileprivate.cpp index 6bd5d3b9a..1dcc6116c 100644 --- a/src/fs/virtfileprivate.cpp +++ b/src/fs/virtfileprivate.cpp @@ -20,15 +20,25 @@ #include "fs/virtfileprivate.h" +#include <unistd.h> + #include "debug.h" VirtFilePrivate::VirtFilePrivate() : - mFile(nullptr) + mFile(nullptr), + mFd(-1) +{ +} + +VirtFilePrivate::VirtFilePrivate(const int fd) : + mFile(nullptr), + mFd(fd) { } VirtFilePrivate::VirtFilePrivate(PHYSFS_file *const file) : - mFile(file) + mFile(file), + mFd(-1) { } @@ -39,4 +49,6 @@ VirtFilePrivate::~VirtFilePrivate() PHYSFS_close(mFile); mFile = nullptr; } + if (mFd != -1) + close(mFd); } |