summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-11 01:34:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-11 01:34:33 +0000
commit039a94478ee4f8b3154e99812223614e03ac186c (patch)
tree0e4a60fcf8f023cdd67f3e8132c6e5e6ced199dc /ext
parent27e948fd458b06c3a018d46f04599a874f43fd92 (diff)
.*/.+/.?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/extmk.rb.nt1
-rw-r--r--ext/readline/readline.c2
-rw-r--r--ext/socket/socket.c55
3 files changed, 8 insertions, 50 deletions
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
index b5aa459..379d1bb 100644
--- a/ext/extmk.rb.nt
+++ b/ext/extmk.rb.nt
@@ -256,6 +256,7 @@ SRC
end
def arg_config(config, default=nil)
+ return default if /mswin32/i =~ PLATFORM
unless defined? $configure_args
$configure_args = {}
for arg in ENV["CONFIGURE_ARGS"].split
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 84b98f0..dbee8c7 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -79,6 +79,8 @@ readline_attempted_completion_function(char *text, int start, int end)
int i, matches;
proc = rb_iv_get(mReadline, COMPLETION_PROC);
+ if (NIL_P(proc))
+ return NULL;
rl_attempted_completion_over = 1;
case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD));
ary = rb_funcall(proc, rb_intern("call"), 1, rb_str_new2(text));
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 875f6f3..1f19b05 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -518,7 +518,6 @@ thread_write_select(fd)
rb_thread_select(fd+1, 0, &fds, 0, 0);
}
-#if defined(HAVE_FCNTL)
static int
ruby_connect(fd, sockaddr, len, socks)
int fd;
@@ -529,6 +528,7 @@ ruby_connect(fd, sockaddr, len, socks)
int status;
int mode;
+#if defined(HAVE_FCNTL)
mode = fcntl(fd, F_GETFL, 0);
#ifdef O_NDELAY
@@ -541,6 +541,8 @@ ruby_connect(fd, sockaddr, len, socks)
#endif
#endif
fcntl(fd, F_SETFL, mode|NONBLOCKING);
+#endif /* HAVE_FCNTL */
+
for (;;) {
#ifdef SOCKS
if (socks) {
@@ -568,36 +570,14 @@ ruby_connect(fd, sockaddr, len, socks)
#endif
}
}
+#ifdef HAVE_FCNTL
mode &= ~NONBLOCKING;
fcntl(fd, F_SETFL, mode);
+#endif
return status;
}
}
-#else
-
-#ifdef SOCKS
-static int
-ruby_connect(fd, sockaddr, len, socks)
- int fd;
- struct sockaddr *sockaddr;
- int len;
- int socks;
-{
- if (socks) {
- return Rconnect(fd, sockaddr, len);
- }
- else {
- return connect(fd, sockaddr, len);
- }
-}
-#else
-
-#define ruby_connect(fd, sockaddr, len, socks) connect(fd, sockaddr, len)
-
-#endif /* SOCKS */
-#endif
-
static VALUE
open_inet(class, h, serv, type)
VALUE class, h, serv;
@@ -1054,23 +1034,10 @@ udp_connect(sock, host, port)
fd = fileno(fptr->f);
res0 = udp_addrsetup(fptr, host, port);
for (res = res0; res; res = res->ai_next) {
- retry:
if (ruby_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
freeaddrinfo(res0);
return INT2FIX(0);
}
- switch (errno) {
- case EINTR:
- rb_thread_schedule();
- goto retry;
-
- case EWOULDBLOCK:
-#if EAGAIN != EWOULDBLOCK
- case EAGAIN:
-#endif
- thread_write_select(fd);
- goto retry;
- }
}
freeaddrinfo(res0);
@@ -1386,19 +1353,7 @@ sock_connect(sock, addr)
GetOpenFile(sock, fptr);
fd = fileno(fptr->f);
- retry:
if (ruby_connect(fd, (struct sockaddr*)RSTRING(addr)->ptr, RSTRING(addr)->len, 0) < 0) {
- switch (errno) {
- case EINTR:
- rb_thread_schedule();
- goto retry;
- case EWOULDBLOCK:
-#if EAGAIN != EWOULDBLOCK
- case EAGAIN:
-#endif
- thread_write_select(fd);
- goto retry;
- }
rb_sys_fail("connect(2)");
}