From b29ad4cd95d4f56f60f1099caebfc92fb1019891 Mon Sep 17 00:00:00 2001 From: eban Date: Mon, 6 Feb 2006 07:13:53 +0000 Subject: * file.c (cygwin_flock): save old errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/file.c b/file.c index ea89bc9fe6..8ce4ca4851 100644 --- a/file.c +++ b/file.c @@ -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) -- cgit v1.2.3