From 39a85818251297b5a76f817d21455f617cbcd70b Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 5 Jan 2016 01:51:15 -0800 Subject: [PATCH] Return null when file fails to oepn --- hecl/include/HECL/HECL.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hecl/include/HECL/HECL.hpp b/hecl/include/HECL/HECL.hpp index 21ce557d7..0cc9edc35 100644 --- a/hecl/include/HECL/HECL.hpp +++ b/hecl/include/HECL/HECL.hpp @@ -279,11 +279,11 @@ static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLo #if HECL_UCS2 FILE* fp = _wfopen(path, mode); if (!fp) - LogModule.report(LogVisor::FatalError, L"fopen %s: %s", path, _wcserror(errno)); + return nullptr; #else FILE* fp = fopen(path, mode); if (!fp) - LogModule.report(LogVisor::FatalError, "fopen %s: %s", path, strerror(errno)); + return nullptr; #endif if (lock != FileLockType::None) @@ -293,7 +293,7 @@ static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLo LockFileEx((HANDLE)(uintptr_t)_fileno(fp), (lock == FileLockType::Write) ? LOCKFILE_EXCLUSIVE_LOCK : 0, 0, 0, 1, &ov); #else if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB)) - LogModule.report(LogVisor::FatalError, "flock %s: %s", path, strerror(errno)); + LogModule.report(LogVisor::Error, "flock %s: %s", path, strerror(errno)); #endif }