summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
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 176e2e57e2..b470bd9ab8 100644
--- a/file.c
+++ b/file.c
@@ -3112,9 +3112,12 @@ static int
#include <winerror.h>
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)