From 203fb71851cb823775944209f9fae0901f47db6b Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Wed, 18 May 2016 22:59:17 +0100 Subject: [PATCH] linux:async-iso: Fix invalid file descriptor checks -1 is returned when open() fails, not 0. --- pcsx2/Linux/LnxFlatFileReader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pcsx2/Linux/LnxFlatFileReader.cpp b/pcsx2/Linux/LnxFlatFileReader.cpp index 3c8ba3c7f7..1b2c6b5213 100644 --- a/pcsx2/Linux/LnxFlatFileReader.cpp +++ b/pcsx2/Linux/LnxFlatFileReader.cpp @@ -19,7 +19,7 @@ FlatFileReader::FlatFileReader(bool shareWrite) : shareWrite(shareWrite) { m_blocksize = 2048; - m_fd = 0; + m_fd = -1; m_aio_context = 0; } @@ -37,7 +37,7 @@ bool FlatFileReader::Open(const wxString& fileName) m_fd = wxOpen(fileName, O_RDONLY, 0); - return (m_fd != 0); + return (m_fd != -1); } int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count) @@ -87,11 +87,11 @@ void FlatFileReader::CancelRead(void) void FlatFileReader::Close(void) { - if (m_fd) close(m_fd); + if (m_fd != -1) close(m_fd); io_destroy(m_aio_context); - m_fd = 0; + m_fd = -1; m_aio_context = 0; }