summaryrefslogtreecommitdiff
path: root/Cytore.hpp
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-01-29 07:32:55 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2017-01-29 07:32:55 -0800
commit7a6e17cff79a3a007a2519bdb676f1be8e937624 (patch)
treec9c7ee055334d10d2b4e095f7015c6a31153d22a /Cytore.hpp
parent1fe922cd8b76cffdb15eac07f6e686449e1b1469 (diff)
If Cytore fails to allocate an empty file, unlink.
Diffstat (limited to 'Cytore.hpp')
-rw-r--r--Cytore.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Cytore.hpp b/Cytore.hpp
index 714da26..a382dd8 100644
--- a/Cytore.hpp
+++ b/Cytore.hpp
@@ -190,7 +190,11 @@ class File {
size_t size(stat.st_size);
if (size == 0) {
- _assert(Truncate_(core));
+ if (!Truncate_(core)) {
+ unlink(path);
+ _assert(false);
+ }
+
Header_().magic_ = Magic;
Size_() = core;
} else {