mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
* win32/win32.c (LK_ERR): ERROR_NOT_LOCKED is not an error.
In such situation, flock() should return 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a98d2cd4a9
commit
f0432871fd
2 changed files with 19 additions and 1 deletions
|
@ -245,7 +245,20 @@ GetCurrentThreadHandle(void)
|
|||
/* simulate flock by locking a range on the file */
|
||||
|
||||
|
||||
#define LK_ERR(f,i) ((f) ? (i = 0) : (errno = GetLastError() == ERROR_LOCK_VIOLATION ? EWOULDBLOCK : EACCES))
|
||||
#define LK_ERR(f,i) \
|
||||
do { \
|
||||
if (f) \
|
||||
i = 0; \
|
||||
else { \
|
||||
DWORD err = GetLastError(); \
|
||||
if (err == ERROR_LOCK_VIOLATION) \
|
||||
errno = EWOULDBLOCK; \
|
||||
else if (err == ERROR_NOT_LOCKED) \
|
||||
i = 0; \
|
||||
else \
|
||||
errno = map_errno(err); \
|
||||
} \
|
||||
} while (0)
|
||||
#define LK_LEN ULONG_MAX
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue