FIX #2122: file locking bug
authorSimon Marlow <simonmar@microsoft.com>
Tue, 26 Feb 2008 10:46:50 +0000 (10:46 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Tue, 26 Feb 2008 10:46:50 +0000 (10:46 +0000)
Second and subsequent readers weren't being inserted into the
fd->lock hash table, which meant that the file wasn't correctly
unlocked when the Handles were closed.

rts/posix/FileLock.c

index 436d8c9..8d25820 100644 (file)
@@ -88,6 +88,7 @@ lockFile(int fd, dev_t dev, ino_t ino, int for_writing)
         if (for_writing || lock->readers < 0) {
             return -1;
         }
         if (for_writing || lock->readers < 0) {
             return -1;
         }
+        insertHashTable(fd_hash, fd, lock);
         lock->readers++;
         return 0;
     }
         lock->readers++;
         return 0;
     }