Bug #9036 ยป 0001-io.c-make-IO-reopen-pathname-atomic.patch
io.c | ||
---|---|---|
}
|
||
}
|
||
else {
|
||
if (close(fptr->fd) < 0)
|
||
int tmpfd = rb_sysopen(fptr->pathv, oflags, 0666);
|
||
int err = 0;
|
||
if (rb_cloexec_dup2(tmpfd, fptr->fd) < 0)
|
||
err = errno;
|
||
(void)close(tmpfd);
|
||
if (err) {
|
||
errno = err;
|
||
rb_sys_fail_path(fptr->pathv);
|
||
fptr->fd = -1;
|
||
fptr->fd = rb_sysopen(fptr->pathv, oflags, 0666);
|
||
}
|
||
}
|
||
return file;
|