1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (fptr_finalize): should save errno just after failure.

[ruby-dev:22492]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-01-06 12:55:05 +00:00
parent 7cf7bb6987
commit 4e8cfd8b47
2 changed files with 22 additions and 16 deletions

View file

@ -1,3 +1,8 @@
Tue Jan 6 21:55:02 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (fptr_finalize): should save errno just after failure.
[ruby-dev:22492]
Tue Jan 6 14:53:14 2004 Dave Thomas <dave@pragprog.com>
* bin/ri: split out the display side, making it pluggable. Added
@ -20,7 +25,7 @@ Tue Jan 6 06:37:53 2004 Dave Thomas <dave@pragprog.com>
Tue Jan 6 00:04:40 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
fix parsing if there are braces in a method parameter list
Tue Jan 6 06:37:53 2004 Dave Thomas <dave@pragprog.com>
@ -40,21 +45,21 @@ Tue Jan 6 06:37:53 2004 Dave Thomas <dave@pragprog.com>
Tue Jan 6 00:04:40 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
fix parsing if there are braces in a method parameter list
Tue Jan 6 00:04:40 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
fix parsing if there are braces in a method parameter list
Tue Jan 6 00:04:40 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method_or_yield_parameters):
fix parsing if there are braces in a method parameter list
Fri Jan 2 14:54:11 2004 Dave Thomas <dave@pragprog.com>
* bin/ri: Add new --classes option, and arrange for
help messages to be paged too.
@ -62,7 +67,7 @@ Fri Jan 2 14:54:11 2004 Dave Thomas <dave@pragprog.com>
* process.c: (MG) Added Process documentation
* lib/rdoc/ri/ri_formatter.rb (RI::AttributeFormatter::wrap):
* lib/rdoc/ri/ri_formatter.rb (RI::AttributeFormatter::wrap):
Fix problem with labels not displaying in RI labeled
lists using BS and ANSI modes.
@ -91,8 +96,8 @@ Tue Dec 30 12:30:30 2003 Dave Thomas <dave@pragprog.com>
Tue Dec 30 08:32:32 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method):
Handle undoing nesting of yield parameters correctly for:
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_method):
Handle undoing nesting of yield parameters correctly for:
def each_entry(&b) Dir.foreach(@path) {|f| yield P.new(f) } end
@ -150,7 +155,7 @@ Sun Dec 28 08:56:51 2003 Dave Thomas <dave@pragprog.com>
Sun Dec 28 03:50:05 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_override_comment):
* lib/rdoc/parsers/parse_c.rb (RDoc::C_Parser::find_override_comment):
Escape method names used in regexp
Sun Dec 28 01:46:02 2003 Dave Thomas <dave@pragprog.com>

15
io.c
View file

@ -1726,12 +1726,12 @@ fptr_finalize(fptr, noraise)
OpenFile *fptr;
int noraise;
{
int n1 = 0, n2 = 0, e = 0, f1, f2 = -1;
int n1 = 0, n2 = 0, f1, f2 = -1;
if (fptr->f2) {
f2 = fileno(fptr->f2);
while ((n2 = fclose(fptr->f2)) < 0) {
e = errno;
while (n2 = 0, fclose(fptr->f2) < 0) {
n2 = errno;
if (!rb_io_wait_writable(f2)) {
break;
}
@ -1741,18 +1741,19 @@ fptr_finalize(fptr, noraise)
}
if (fptr->f) {
f1 = fileno(fptr->f);
while ((n1 = fclose(fptr->f)) < 0) {
while (n1 = 0, fclose(fptr->f) < 0) {
n1 = errno;
if (f2 != -1 || !(fptr->mode & FMODE_WBUF)) break;
if (!rb_io_wait_writable(f1)) break;
if (!fptr->f) break;
}
fptr->f = 0;
if (n1 < 0 && errno == EBADF && f1 == f2) {
if (n1 == EBADF && f1 == f2) {
n1 = 0;
}
}
if (!noraise && (n1 < 0 || n2 < 0)) {
if (n1 == 0) errno = e;
if (!noraise && (n1 || n2)) {
errno = (n1 ? n1 : n2);
rb_sys_fail(fptr->path);
}
}