From eb8844fd113d3fdae0456d56bdb0eb56e3a5f26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 26 Jul 2020 20:59:58 +0300 Subject: Fix casepath chaos --- src/audio/oal/stream.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/audio/oal/stream.cpp') diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp index 1ffe941e..9fad47a9 100644 --- a/src/audio/oal/stream.cpp +++ b/src/audio/oal/stream.cpp @@ -203,15 +203,11 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF { // Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/) #if !defined(_WIN32) - FILE *test = fopen(filename, "r"); - if (!test) { - char *r = (char*)alloca(strlen(filename) + 4); - if (casepath(filename, r)) - { - strcpy(m_aFilename, r); - } + char *real = casepath(filename); + if (real) { + strcpy(m_aFilename, real); + free(real); } else { - fclose(test); #else { #endif -- cgit v1.2.3