ext/kgio/connect.c in kgio-2.8.0 vs ext/kgio/connect.c in kgio-2.8.0.2.g30c1

- old
+ new

@@ -34,11 +34,11 @@ int fd; retry: fd = socket(domain, MY_SOCK_STREAM, 0); - if (fd == -1) { + if (fd < 0) { switch (errno) { case EMFILE: case ENFILE: #ifdef ENOBUFS case ENOBUFS: @@ -51,16 +51,16 @@ if (MY_SOCK_STREAM != SOCK_STREAM) { MY_SOCK_STREAM = SOCK_STREAM; goto retry; } } - if (fd == -1) + if (fd < 0) rb_sys_fail("socket"); } if (MY_SOCK_STREAM == SOCK_STREAM) { - if (fcntl(fd, F_SETFL, O_RDWR | O_NONBLOCK) == -1) + if (fcntl(fd, F_SETFL, O_RDWR | O_NONBLOCK) < 0) close_fail(fd, "fcntl(F_SETFL, O_RDWR | O_NONBLOCK)"); rb_fd_fix_cloexec(fd); } return fd; @@ -69,10 +69,10 @@ static VALUE my_connect(VALUE klass, int io_wait, int domain, void *addr, socklen_t addrlen) { int fd = my_socket(domain); - if (connect(fd, addr, addrlen) == -1) { + if (connect(fd, addr, addrlen) < 0) { if (errno == EINPROGRESS) { VALUE io = sock_for_fd(klass, fd); if (io_wait) { errno = EAGAIN;