Comparison

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
parent 5812:57ebf93ec720
child 5928:1f6923702fc3
child 6154:dfe88a0e18fd
comparison
equal deleted inserted replaced
5924:f44c1dabd4e9 5927:49e3c49eb0d8
664 #if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L || defined(_GNU_SOURCE) 664 #if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L || defined(_GNU_SOURCE)
665 int lc_fallocate(lua_State* L) 665 int lc_fallocate(lua_State* L)
666 { 666 {
667 off_t offset, len; 667 off_t offset, len;
668 FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); 668 FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE);
669 if (f == NULL)
670 luaL_error(L, "attempt to use a closed file");
669 671
670 offset = luaL_checkinteger(L, 2); 672 offset = luaL_checkinteger(L, 2);
671 len = luaL_checkinteger(L, 3); 673 len = luaL_checkinteger(L, 3);
672 674
673 #if defined(__linux__) && defined(_GNU_SOURCE) 675 #if defined(__linux__) && defined(_GNU_SOURCE)