diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) |