Vincent Povirk : server: Try to get a read lock if we can' t get a write lock.

Alexandre Julliard julliard at winehq.org
Fri May 9 13:32:35 CDT 2014


Module: wine
Branch: master
Commit: 473a3a47a7d02694e659760008c1856f305cd82c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=473a3a47a7d02694e659760008c1856f305cd82c

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu May  8 15:03:10 2014 -0500

server: Try to get a read lock if we can't get a write lock.

---

 server/fd.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/fd.c b/server/fd.c
index fa8874c..7043d04 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1175,8 +1175,12 @@ static int set_unix_lock( struct fd *fd, file_pos_t start, file_pos_t end, int t
             return 0;
         case EBADF:
             /* this can happen if we try to set a write lock on a read-only file */
-            /* we just ignore that error */
-            if (fl.l_type == F_WRLCK) return 1;
+            /* try to at least grab a read lock */
+            if (fl.l_type == F_WRLCK)
+            {
+                type = F_RDLCK;
+                break; /* retry */
+            }
             set_error( STATUS_ACCESS_DENIED );
             return 0;
 #ifdef EOVERFLOW




More information about the wine-cvs mailing list