From 4c36359dea36a28751659e34a7a11a311f349e76 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 20 May 2004 04:28:36 +0000 Subject: [PATCH] * numeric.c (flo_eq): alway check if operands are NaN. [ruby-list:39685] * lib/cgi/session.rb: use LOCK_SH to read, and a few other improvements. [ruby-core:02328] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 13 +++++++++-- configure.in | 2 ++ ext/socket/getaddrinfo.c | 3 +++ ext/socket/getnameinfo.c | 3 +++ lib/cgi/session.rb | 49 ++++++++++++++++++++-------------------- lib/mkmf.rb | 2 +- numeric.c | 2 -- 7 files changed, 44 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55501fd6d8..67760f3665 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu May 20 12:38:06 2004 Yukihiro Matsumoto + + * numeric.c (flo_eq): alway check if operands are NaN. + [ruby-list:39685] + Thu May 20 12:34:39 2004 Dave Thomas * lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_visibility): @@ -7,8 +12,7 @@ Thu May 20 12:34:39 2004 Dave Thomas Thu May 20 12:22:13 2004 Nobuyoshi Nakada * lib/mkmf.rb (have_type): do not check pointer to incomplete type, - which always get compiled. - [ruby-list:39683] + which always get compiled. [ruby-list:39683] Wed May 19 11:09:00 2004 Hidetoshi NAGAI @@ -1297,6 +1301,11 @@ Thu Jan 29 15:33:23 2004 GOTOU Yuuzou * sample/openssl/gen_csr.rb: use OpenSSL::X509::Name.parse. +Wed Jan 28 04:29:41 2004 Eric Schwartz + + * lib/cgi/session.rb: use LOCK_SH to read, and a few other + improvements. [ruby-core:02328] + Tue Jan 27 11:09:29 2004 FUKUMOTO Atsushi * ext/socket/socket.c (s_recvfrom): sending length should be an diff --git a/configure.in b/configure.in index 26fc5d265e..79464c9ff1 100644 --- a/configure.in +++ b/configure.in @@ -350,6 +350,8 @@ freebsd*) LIBS="-lm $LIBS" ;; bow) ac_cv_func_setitimer=no ;; +superux*) ac_cv_func_setitimer=no + ;; *) LIBS="-lm $LIBS";; esac AC_CHECK_LIB(crypt, crypt) diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index c05fbd57ba..14bedb2e9b 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -56,6 +56,9 @@ #endif #include #if defined(HAVE_RESOLV_H) +#ifdef _SX +#include +#endif #include #endif #include diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index a75f233a81..4c9c8f03c4 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -51,6 +51,9 @@ #endif #include #if defined(HAVE_RESOLV_H) +#ifdef _SX +#include +#endif #include #endif #endif diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index 10266b56ff..8453501399 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -364,16 +364,11 @@ class CGI unless check_id(id) raise ArgumentError, "session_id `%s' is invalid" % id end - path = dir+"/"+prefix+id - path.untaint - unless File::exist? path + @path = dir+"/"+prefix+id + @path.untaint + unless File::exist? @path @hash = {} end - begin - @f = open(path, "r+") - rescue Errno::ENOENT - @f = open(path, "w+") - end end # Restore session state from the session's FileStore file. @@ -382,13 +377,17 @@ class CGI def restore unless @hash @hash = {} - @f.flock File::LOCK_EX - @f.rewind - for line in @f - line.chomp! - k, v = line.split('=',2) - @hash[CGI::unescape(k)] = CGI::unescape(v) - end + begin + f = File.open(@path, 'r') + f.flock File::LOCK_SH + for line in f + line.chomp! + k, v = line.split('=',2) + @hash[CGI::unescape(k)] = CGI::unescape(v) + end + ensure + f.close unless f.nil? + end end @hash end @@ -396,25 +395,25 @@ class CGI # Save session state to the session's FileStore file. def update return unless @hash - @f.rewind - for k,v in @hash - @f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v)) - end - @f.truncate @f.tell + begin + f = File.open(@path, 'w') + f.flock File::LOCK_EX + for k,v in @hash + f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v)) + end + ensure + f.close unless f.nil? + end end # Update and close the session's FileStore file. def close - return if @f.closed? update - @f.close end # Close and delete the session's FileStore file. def delete - path = @f.path - @f.close - File::unlink path + File::unlink @path end end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 3f4dcd8148..ed0203b9ca 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -582,7 +582,7 @@ def check_sizeof(type, header = nil, &b) end message(a = size ? "#{size}\n" : "failed\n") Logging::message "-------------------- %s\n", a - r + size end def find_executable0(bin, path = nil) diff --git a/numeric.c b/numeric.c index 2d33b49bab..92a435df15 100644 --- a/numeric.c +++ b/numeric.c @@ -833,9 +833,7 @@ flo_eq(x, y) return num_equal(x, y); } a = RFLOAT(x)->value; -#if defined __BORLANDC__ if (isnan(a) || isnan(b)) return Qfalse; -#endif return (a == b)?Qtrue:Qfalse; }