mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-14 17:16:36 +00:00
Fix a potential data abort when flushing the placeholder accessor cache
This commit is contained in:
parent
1b99cd6b4d
commit
1cd8ac2bb2
1 changed files with 6 additions and 3 deletions
|
@ -206,12 +206,15 @@ namespace sts::ncm::impl {
|
||||||
if (cache == nullptr) {
|
if (cache == nullptr) {
|
||||||
cache = &this->caches[0];
|
cache = &this->caches[0];
|
||||||
|
|
||||||
/* Flush and close */
|
/* Flush and close any handles. */
|
||||||
fsync(fileno(cache->handle));
|
if (cache->handle) {
|
||||||
fclose(cache->handle);
|
fsync(fileno(cache->handle));
|
||||||
|
fclose(cache->handle);
|
||||||
|
}
|
||||||
cache->id = InvalidUuid;
|
cache->id = InvalidUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cache the new placeholder id and its file handle. */
|
||||||
cache->id = placeholder_id;
|
cache->id = placeholder_id;
|
||||||
cache->handle = handle;
|
cache->handle = handle;
|
||||||
cache->counter = this->cur_counter;
|
cache->counter = this->cur_counter;
|
||||||
|
|
Loading…
Reference in a new issue