From 741d0f8116bbffb75abec9854c9d2fee2c72b7e8 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 27 Jul 2019 13:32:49 +1000 Subject: [PATCH] Fixed more stdio error handling --- .../ncm/source/impl/ncm_placeholder_accessor.cpp | 4 ++-- stratosphere/ncm/source/ncm_contentstorage.cpp | 10 +++++----- stratosphere/ncm/source/ncm_readonlycontentstorage.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp b/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp index 5b6cf5d78..5bea9b33a 100644 --- a/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp +++ b/stratosphere/ncm/source/impl/ncm_placeholder_accessor.cpp @@ -143,11 +143,11 @@ namespace sts::ncm::impl { this->StoreToCache(f, placeholder_id); - if (!fseek(f, 0L, SEEK_END)) { + if (fseek(f, 0L, SEEK_END) != 0) { return fsdevGetLastResult(); } size_t size = ftell(f); - if (!fseek(f, 0L, SEEK_SET)) { + if (fseek(f, 0L, SEEK_SET) != 0) { return fsdevGetLastResult(); } diff --git a/stratosphere/ncm/source/ncm_contentstorage.cpp b/stratosphere/ncm/source/ncm_contentstorage.cpp index 75255d69e..cd259df3f 100644 --- a/stratosphere/ncm/source/ncm_contentstorage.cpp +++ b/stratosphere/ncm/source/ncm_contentstorage.cpp @@ -158,7 +158,7 @@ namespace sts::ncm { } } R_END_TRY_CATCH; - if (!fseek(f, offset, SEEK_SET)) { + if (fseek(f, offset, SEEK_SET) != 0) { return fsdevGetLastResult(); } @@ -188,7 +188,7 @@ namespace sts::ncm { this->placeholder_accessor.GetPlaceHolderPathUncached(placeholder_path, placeholder_id); this->GetContentPath(content_path, content_id); - if (!rename(placeholder_path, content_path)) { + if (rename(placeholder_path, content_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { R_CATCH(ResultFsPathNotFound) { return ResultNcmPlaceHolderNotFound; @@ -423,7 +423,7 @@ namespace sts::ncm { R_TRY(this->placeholder_accessor.EnsureRecursively(placeholder_id)); this->placeholder_accessor.GetPlaceHolderPathUncached(placeholder_path, placeholder_id); - if (!rename(old_content_path, placeholder_path)) { + if (rename(old_content_path, placeholder_path) != 0) { R_TRY_CATCH(fsdevGetLastResult()) { R_CATCH(ResultFsPathNotFound) { return ResultNcmPlaceHolderNotFound; @@ -460,7 +460,7 @@ namespace sts::ncm { this->GetContentPath(content_path, content_id); R_TRY(this->OpenCachedContentFile(content_id)); - if (!fseek(this->content_cache_file_handle, offset, SEEK_SET)) { + if (fseek(this->content_cache_file_handle, offset, SEEK_SET) != 0) { return fsdevGetLastResult(); } @@ -582,7 +582,7 @@ namespace sts::ncm { return fsdevGetLastResult(); } - if (!fseek(f, offset, SEEK_SET)) { + if (fseek(f, offset, SEEK_SET) != 0) { return fsdevGetLastResult(); } diff --git a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp index 307631a76..246fa05b5 100644 --- a/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp +++ b/stratosphere/ncm/source/ncm_readonlycontentstorage.cpp @@ -192,7 +192,7 @@ namespace sts::ncm { return fsdevGetLastResult(); } - if (!fseek(f, offset, SEEK_SET)) { + if (fseek(f, offset, SEEK_SET) != 0) { return fsdevGetLastResult(); }