diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-04 12:21:55 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-04 12:21:55 +0000 |
| commit | 9f537bacc1a402f212598b4f4782ebcf4d1dd5f3 (patch) | |
| tree | 597e49918431fc076f026c6f8cde0c0c3b9a060d | |
| parent | ba3fd166648e51b61c4d644182a599f3359aec04 (diff) | |
| download | ruby-9f537bacc1a402f212598b4f4782ebcf4d1dd5f3.tar.gz ruby-9f537bacc1a402f212598b4f4782ebcf4d1dd5f3.tar.xz ruby-9f537bacc1a402f212598b4f4782ebcf4d1dd5f3.zip | |
* win32/win32.c (LK_ERR): ERROR_NOT_LOCKED is not an error.
In such situation, flock() should return 0.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | win32/win32.c | 15 |
2 files changed, 19 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Sat Feb 4 21:10:06 2006 NAKAMURA Usaku <usa@ruby-lang.org> + + * win32/win32.c (LK_ERR): ERROR_NOT_LOCKED is not an error. + In such situation, flock() should return 0. + Sat Feb 4 15:52:56 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> * numeric.c (fix_to_s): (2**32).to_s(2) fails with exception where diff --git a/win32/win32.c b/win32/win32.c index 9c06e2562..b1c6197ec 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -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 |
