diff options
author | Kim Alvefur <zash@zash.se> | 2015-05-02 14:41:56 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-05-02 14:41:56 +0200 |
commit | ad9d518ec1b82a9585e5b77604d50014acd58e26 (patch) | |
tree | 815aa8158e46ee7f77f0477a66cc24d30d825d33 | |
parent | 53e2d9e8a3d003eb3f3218f98335f8375bfcfb09 (diff) | |
download | prosody-ad9d518ec1b82a9585e5b77604d50014acd58e26.tar.gz prosody-ad9d518ec1b82a9585e5b77604d50014acd58e26.zip |
util.pposix: Return error from ftruncate if that fails too (but what would we do here?)
-rw-r--r-- | util-src/pposix.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; } } |