[Box Backup-commit] COMMIT r3628 - box/trunk/lib/common

subversion at boxbackup.org subversion at boxbackup.org
Sat Aug 15 11:58:28 BST 2015


Author: chris
Date: 2015-08-15 10:58:28 +0000 (Sat, 15 Aug 2015)
New Revision: 3628

Modified:
   box/trunk/lib/common/NamedLock.cpp
Log:
Reset NamedLock file descriptor immediately after closing.

Otherwise, if we fail to unlink the lockfile, we will try to close it again,
which will fail because it's already closed, and we'll never get around to
unlinking it.

Modified: box/trunk/lib/common/NamedLock.cpp
===================================================================
--- box/trunk/lib/common/NamedLock.cpp	2015-08-15 10:58:21 UTC (rev 3627)
+++ box/trunk/lib/common/NamedLock.cpp	2015-08-15 10:58:28 UTC (rev 3628)
@@ -236,6 +236,9 @@
 			CommonException, OSFileError);
 	}
 
+	// Mark as unlocked, so we don't try to close it again if the unlink() fails.
+	mFileDescriptor = -1;
+
 #ifdef WIN32
 	// On Windows we need to close the file before deleting it, otherwise
 	// the system won't let us delete it.
@@ -248,9 +251,6 @@
 	}
 #endif // WIN32
 
-	// Mark as unlocked, so we don't try to close it again if the unlink() fails.
-	mFileDescriptor = -1;
-
 	BOX_TRACE("Released lock and deleted lockfile " << mFileName);
 }
 




More information about the Boxbackup-commit mailing list