From 625aabedd04172aa57b9903ff328375c4c9fa828 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 12 Feb 2011 21:26:08 -0800 Subject: Support ftruncate error conditions. --- Cytore.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Cytore.hpp') diff --git a/Cytore.hpp b/Cytore.hpp index cb6c424..168f2ef 100644 --- a/Cytore.hpp +++ b/Cytore.hpp @@ -142,8 +142,11 @@ class File { bool Truncate_(size_t capacity) { capacity = Round(capacity, Block_); + int error(ftruncate(file_, capacity)); - _assert(error == 0); + if (error != 0) + return false; + Map_(capacity); return true; } -- cgit v1.2.3