aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/pposix.c
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-11-28 16:12:40 +0100
committerKim Alvefur <zash@zash.se>2013-11-28 16:12:40 +0100
commit605d7d941a2f412bb5c8acf98d81aeafc2bc0fdd (patch)
tree970f113ae768ce4ffe0240945cf6ca6a6b1778ae /util-src/pposix.c
parent2cb8a9b4fbed97f58a270ec399bacf379d596e58 (diff)
downloadprosody-605d7d941a2f412bb5c8acf98d81aeafc2bc0fdd.tar.gz
prosody-605d7d941a2f412bb5c8acf98d81aeafc2bc0fdd.zip
util.pposix: Verify that file handle is open
Diffstat (limited to 'util-src/pposix.c')
-rw-r--r--util-src/pposix.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 7f64038b..4fb1fb56 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -666,6 +666,8 @@ int lc_fallocate(lua_State* L)
{
off_t offset, len;
FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE);
+ if (f == NULL)
+ luaL_error(L, "attempt to use a closed file");
offset = luaL_checkinteger(L, 2);
len = luaL_checkinteger(L, 3);