From ad9d518ec1b82a9585e5b77604d50014acd58e26 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 2 May 2015 14:41:56 +0200 Subject: util.pposix: Return error from ftruncate if that fails too (but what would we do here?) --- util-src/pposix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util-src') diff --git a/util-src/pposix.c b/util-src/pposix.c index d797f032..5288b08c 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -750,7 +750,10 @@ int lc_fallocate(lua_State* L) { lua_pushstring(L, strerror(ret)); /* posix_fallocate() can leave a bunch of NULs at the end, so we cut that * this assumes that offset == length of the file */ - ftruncate(fileno(f), offset); + if(ftruncate(fileno(f), offset) != 0) { + lua_pushstring(L, strerror(errno)); + return 3; + } return 2; } } -- cgit v1.2.3