# HG changeset patch # User jbe # Date 1474239930 -7200 # Node ID 385b6607785ab55feee2f27877bfb782d0e64918 # Parent 56c12449bba0db4f2095826e5c610f891a7a0d4c Bugfix: do not attempt flushing/closing if file descriptor has already been closed diff -r 56c12449bba0 -r 385b6607785a moonbridge_io.c --- a/moonbridge_io.c Sun Sep 18 12:02:38 2016 +0200 +++ b/moonbridge_io.c Mon Sep 19 01:05:30 2016 +0200 @@ -742,7 +742,7 @@ moonbr_io_handle_t *handle; handle = luaL_checkudata(L, 1, MOONBR_IO_HANDLE_MT_REGKEY); if (handle->closed) luaL_error(L, "Attempt to close a closed I/O handle"); - if (!reset) { + if (!reset && handle->fd >= 0) { if (handle->writeleft) { lua_pushcfunction(L, moonbr_io_flush); lua_pushvalue(L, 1);