Mercurial > prosody-hg
diff util-src/pposix.c @ 5927:49e3c49eb0d8
util.pposix: Verify that file handle is open
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 28 Nov 2013 16:12:40 +0100 |
| parents | 57ebf93ec720 |
| children | 1f6923702fc3 dfe88a0e18fd |
line wrap: on
line diff
--- a/util-src/pposix.c Fri Nov 22 15:27:21 2013 +0100 +++ b/util-src/pposix.c Thu Nov 28 16:12:40 2013 +0100 @@ -666,6 +666,8 @@ { 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);
