aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
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
commitd1a264a39af9e9d29090a8d294cb34d632eff110 (patch)
tree815aa8158e46ee7f77f0477a66cc24d30d825d33 /util-src
parentc98f87b4a77b152e7abb8a95402f1292ac937ebc (diff)
downloadprosody-d1a264a39af9e9d29090a8d294cb34d632eff110.tar.gz
prosody-d1a264a39af9e9d29090a8d294cb34d632eff110.zip
util.pposix: Return error from ftruncate if that fails too (but what would we do here?)
Diffstat (limited to 'util-src')
-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;
}
}