summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-06 07:13:53 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-06 07:13:53 +0000
commitb29ad4cd95d4f56f60f1099caebfc92fb1019891 (patch)
tree1306d0e1b2422b56086b858b21de2e64114d8c0b /file.c
parent895778951ed1f79da411453e6eb93e9592730a35 (diff)
* file.c (cygwin_flock): save old errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c5
1 files changed, 4 insertions, 1 deletions
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)