# HG changeset patch # User jbe # Date 1428174675 -7200 # Node ID 360a1860bb14c04c63d5f90b75615d825593f0d1 # Parent daef4a38cc98fe6946a625feaa7eeec5d4b54518 Fixed io.poll(...) function diff -r daef4a38cc98 -r 360a1860bb14 moonbridge.c --- a/moonbridge.c Sat Apr 04 21:01:41 2015 +0200 +++ b/moonbridge.c Sat Apr 04 21:11:15 2015 +0200 @@ -2309,25 +2309,27 @@ int flags, chr; flockfile(file); fd = fileno_unlocked(file); - if (ferror(file) || feof(file)) goto moonbr_io_poll_pending_shortcut; + if (ferror(file) || feof(file)) goto moonbr_io_poll_pending_shortcut1; flags = fcntl(fd, F_GETFL, 0); if (flags == -1) goto moonbr_io_poll_pending_error; if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) goto moonbr_io_poll_pending_error; chr = getc_unlocked(file); if (chr == EOF) { if (ferror(file) && errno == EAGAIN) clearerr_unlocked(file); - else goto moonbr_io_poll_pending_shortcut; + else goto moonbr_io_poll_pending_shortcut2; } else { if (ungetc(chr, file) == EOF) { fcntl(fd, F_SETFL, flags); goto moonbr_io_poll_pending_error; } - goto moonbr_io_poll_pending_shortcut; + goto moonbr_io_poll_pending_shortcut2; } if (fcntl(fd, F_SETFL, flags) == -1) goto moonbr_io_poll_pending_error; funlockfile(file); goto moonbr_io_poll_pending_cont; - moonbr_io_poll_pending_shortcut: + moonbr_io_poll_pending_shortcut2: + if (fcntl(fd, F_SETFL, flags) == -1) goto moonbr_io_poll_pending_error; + moonbr_io_poll_pending_shortcut1: funlockfile(file); lua_pushboolean(L, 1); return 1;