1
0
Fork 0
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:
eban 2006-02-06 07:13:53 +00:00
parent 895778951e
commit b29ad4cd95

5
file.c
View file

@ -3047,9 +3047,12 @@ rb_file_truncate(VALUE obj, VALUE len)
static int
cygwin_flock(int fd, int op)
{
int old_errno = errno;
int ret = flock(fd, op);
if (GetLastError() == ERROR_NOT_LOCKED)
if (GetLastError() == ERROR_NOT_LOCKED) {
ret = 0;
errno = old_errno;
}
return ret;
}
# define flock(fd, op) cygwin_flock(fd, op)