1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-03 09:02:30 +00:00

Misc fixes

This commit is contained in:
Adubbz 2019-07-27 11:14:39 +10:00
parent 070e1012b8
commit 65b7ac9039
2 changed files with 7 additions and 7 deletions

View file

@ -49,7 +49,7 @@ namespace sts::ncm::impl {
if (found_cache) { if (found_cache) {
/* Flush and close */ /* Flush and close */
fsync(fileno(found_cache->handle)); fflush(found_cache->handle));
fclose(found_cache->handle); fclose(found_cache->handle);
std::fill(found_cache->id.uuid, found_cache->id.uuid + sizeof(PlaceHolderId), 0); std::fill(found_cache->id.uuid, found_cache->id.uuid + sizeof(PlaceHolderId), 0);
} }
@ -196,7 +196,7 @@ namespace sts::ncm::impl {
/* Find an empty cache */ /* Find an empty cache */
for (size_t i = 0; i < MaxCaches; i++) { for (size_t i = 0; i < MaxCaches; i++) {
if (placeholder_id != InvalidUuid) { if (placeholder_id == InvalidUuid) {
cache = &this->caches[i]; cache = &this->caches[i];
break; break;
} }
@ -208,7 +208,7 @@ namespace sts::ncm::impl {
/* Flush and close any handles. */ /* Flush and close any handles. */
if (cache->handle) { if (cache->handle) {
fsync(fileno(cache->handle)); fflush(cache->handle);
fclose(cache->handle); fclose(cache->handle);
} }
cache->id = InvalidUuid; cache->id = InvalidUuid;
@ -226,7 +226,7 @@ namespace sts::ncm::impl {
CacheEntry* cache = &this->caches[i]; CacheEntry* cache = &this->caches[i];
if (cache->id != InvalidUuid) { if (cache->id != InvalidUuid) {
fsync(fileno(cache->handle)); fflush(cache->handle));
fclose(cache->handle); fclose(cache->handle);
cache->id = InvalidUuid; cache->id = InvalidUuid;
} }

View file

@ -163,8 +163,8 @@ namespace sts::ncm {
fseek(f, offset, SEEK_SET); fseek(f, offset, SEEK_SET);
fwrite(data.buffer, sizeof(u8), data.num_elements, f); fwrite(data.buffer, sizeof(u8), data.num_elements, f);
if (this->placeholder_accessor.delay_flush ^ 1) { if (!this->placeholder_accessor.delay_flush) {
fsync(fileno(f)); fflush(f));
} }
this->placeholder_accessor.FlushCache(f, placeholder_id); this->placeholder_accessor.FlushCache(f, placeholder_id);
@ -598,7 +598,7 @@ namespace sts::ncm {
fseek(f, offset, SEEK_SET); fseek(f, offset, SEEK_SET);
fwrite(data.buffer, sizeof(u8), data.num_elements, f); fwrite(data.buffer, sizeof(u8), data.num_elements, f);
fsync(fileno(f)); fflush(f));
if (errno != 0) { if (errno != 0) {
return fsdevGetLastResult(); return fsdevGetLastResult();