зеркало из https://github.com/github/ruby.git
* io.c (fptr_finalize): must not use FILE after fclose().
[ruby-dev:24985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0412ddfd24
Коммит
fa69f28eb5
|
@ -1,3 +1,8 @@
|
|||
Mon Nov 29 13:37:54 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (fptr_finalize): must not use FILE after fclose().
|
||||
[ruby-dev:24985]
|
||||
|
||||
Mon Nov 29 13:13:13 2004 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (CreateChild): push back the last space before next
|
||||
|
|
13
io.c
13
io.c
|
@ -1944,23 +1944,30 @@ fptr_finalize(fptr, noraise)
|
|||
|
||||
if (fptr->f2) {
|
||||
f2 = fileno(fptr->f2);
|
||||
while (n2 = 0, fclose(fptr->f2) < 0) {
|
||||
while (n2 = 0, fflush(fptr->f2) < 0) {
|
||||
n2 = errno;
|
||||
if (!rb_io_wait_writable(f2)) {
|
||||
break;
|
||||
}
|
||||
if (!fptr->f2) break;
|
||||
}
|
||||
if (fclose(fptr->f2) < 0 && n2 == 0) {
|
||||
n2 = errno;
|
||||
}
|
||||
fptr->f2 = 0;
|
||||
}
|
||||
if (fptr->f) {
|
||||
f1 = fileno(fptr->f);
|
||||
while (n1 = 0, fclose(fptr->f) < 0) {
|
||||
if ((f2 == -1) && (fptr->mode & FMODE_WBUF)) {
|
||||
while (n1 = 0, fflush(fptr->f) < 0) {
|
||||
n1 = errno;
|
||||
if (f2 != -1 || !(fptr->mode & FMODE_WBUF)) break;
|
||||
if (!rb_io_wait_writable(f1)) break;
|
||||
if (!fptr->f) break;
|
||||
}
|
||||
}
|
||||
if (fclose(fptr->f) < 0 && n1 == 0) {
|
||||
n1 = errno;
|
||||
}
|
||||
fptr->f = 0;
|
||||
if (n1 == EBADF && f1 == f2) {
|
||||
n1 = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче