mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (cygwin_flock): save old errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
895778951e
commit
b29ad4cd95
1 changed files with 4 additions and 1 deletions
5
file.c
5
file.c
|
@ -3047,9 +3047,12 @@ rb_file_truncate(VALUE obj, VALUE len)
|
||||||
static int
|
static int
|
||||||
cygwin_flock(int fd, int op)
|
cygwin_flock(int fd, int op)
|
||||||
{
|
{
|
||||||
|
int old_errno = errno;
|
||||||
int ret = flock(fd, op);
|
int ret = flock(fd, op);
|
||||||
if (GetLastError() == ERROR_NOT_LOCKED)
|
if (GetLastError() == ERROR_NOT_LOCKED) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
errno = old_errno;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
# define flock(fd, op) cygwin_flock(fd, op)
|
# define flock(fd, op) cygwin_flock(fd, op)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue