moonbridge

changeset 70:360a1860bb14

Fixed io.poll(...) function
author jbe
date Sat Apr 04 21:11:15 2015 +0200 (2015-04-04)
parents daef4a38cc98
children 4628be0a7b98
files moonbridge.c
line diff
     1.1 --- a/moonbridge.c	Sat Apr 04 21:01:41 2015 +0200
     1.2 +++ b/moonbridge.c	Sat Apr 04 21:11:15 2015 +0200
     1.3 @@ -2309,25 +2309,27 @@
     1.4          int flags, chr;
     1.5          flockfile(file);
     1.6          fd = fileno_unlocked(file);
     1.7 -        if (ferror(file) || feof(file)) goto moonbr_io_poll_pending_shortcut;
     1.8 +        if (ferror(file) || feof(file)) goto moonbr_io_poll_pending_shortcut1;
     1.9          flags = fcntl(fd, F_GETFL, 0);
    1.10          if (flags == -1) goto moonbr_io_poll_pending_error;
    1.11          if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) goto moonbr_io_poll_pending_error;
    1.12          chr = getc_unlocked(file);
    1.13          if (chr == EOF) {
    1.14            if (ferror(file) && errno == EAGAIN) clearerr_unlocked(file);
    1.15 -          else goto moonbr_io_poll_pending_shortcut;
    1.16 +          else goto moonbr_io_poll_pending_shortcut2;
    1.17          } else {
    1.18            if (ungetc(chr, file) == EOF) {
    1.19              fcntl(fd, F_SETFL, flags);
    1.20              goto moonbr_io_poll_pending_error;
    1.21            }
    1.22 -          goto moonbr_io_poll_pending_shortcut;
    1.23 +          goto moonbr_io_poll_pending_shortcut2;
    1.24          }
    1.25          if (fcntl(fd, F_SETFL, flags) == -1) goto moonbr_io_poll_pending_error;
    1.26          funlockfile(file);
    1.27          goto moonbr_io_poll_pending_cont;
    1.28 -        moonbr_io_poll_pending_shortcut:
    1.29 +        moonbr_io_poll_pending_shortcut2:
    1.30 +        if (fcntl(fd, F_SETFL, flags) == -1) goto moonbr_io_poll_pending_error;
    1.31 +        moonbr_io_poll_pending_shortcut1:
    1.32          funlockfile(file);
    1.33          lua_pushboolean(L, 1);
    1.34          return 1;

Impressum / About Us