aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/pposix.c
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-05-02 14:41:56 +0200
committerKim Alvefur <zash@zash.se>2015-05-02 14:41:56 +0200
commitad9d518ec1b82a9585e5b77604d50014acd58e26 (patch)
tree815aa8158e46ee7f77f0477a66cc24d30d825d33 /util-src/pposix.c
parent53e2d9e8a3d003eb3f3218f98335f8375bfcfb09 (diff)
downloadprosody-ad9d518ec1b82a9585e5b77604d50014acd58e26.tar.gz
prosody-ad9d518ec1b82a9585e5b77604d50014acd58e26.zip
util.pposix: Return error from ftruncate if that fails too (but what would we do here?)
Diffstat (limited to 'util-src/pposix.c')
-rw-r--r--util-src/pposix.c5
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;
}
}