Changeset

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 5924:f44c1dabd4e9
children 5928:1f6923702fc3 5930:a6a7839364aa
files util-src/pposix.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
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);