summaryrefslogtreecommitdiffstats
path: root/lem/io/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'lem/io/core.c')
-rw-r--r--lem/io/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lem/io/core.c b/lem/io/core.c
index 97d780b..b6e73e8 100644
--- a/lem/io/core.c
+++ b/lem/io/core.c
@@ -210,12 +210,15 @@ io_open(lua_State *T)
static void
push_stdstream(lua_State *L, int fd)
{
+ struct stream *s;
+
/* make the socket non-blocking */
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
luaL_error(L, "error making fd %d non-blocking: %s",
fd, strerror(errno));
- stream_new(L, fd, -2);
+ s = stream_new(L, fd, -2);
+ s->open = 2; /* don't close this in __gc() */
}
int