moonbridge
changeset 259:385b6607785a
Bugfix: do not attempt flushing/closing if file descriptor has already been closed
| author | jbe | 
|---|---|
| date | Mon Sep 19 01:05:30 2016 +0200 (2016-09-19) | 
| parents | 56c12449bba0 | 
| children | 1dc729343830 | 
| files | moonbridge_io.c | 
   line diff
1.1 --- a/moonbridge_io.c Sun Sep 18 12:02:38 2016 +0200 1.2 +++ b/moonbridge_io.c Mon Sep 19 01:05:30 2016 +0200 1.3 @@ -742,7 +742,7 @@ 1.4 moonbr_io_handle_t *handle; 1.5 handle = luaL_checkudata(L, 1, MOONBR_IO_HANDLE_MT_REGKEY); 1.6 if (handle->closed) luaL_error(L, "Attempt to close a closed I/O handle"); 1.7 - if (!reset) { 1.8 + if (!reset && handle->fd >= 0) { 1.9 if (handle->writeleft) { 1.10 lua_pushcfunction(L, moonbr_io_flush); 1.11 lua_pushvalue(L, 1);