[or-cvs] r17244: {tor} apply sebastian's fix for bug 859. Apparently on win32 one m (in tor/trunk: . src/common)

nickm at seul.org nickm at seul.org
Tue Nov 11 15:29:41 UTC 2008


Author: nickm
Date: 2008-11-11 10:29:40 -0500 (Tue, 11 Nov 2008)
New Revision: 17244

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/compat.c
Log:
apply sebastian's fix for bug 859. Apparently on win32 one must lock at least one byte when locking, but locking a nonexistant byte is okay. ) 

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-11-11 14:43:36 UTC (rev 17243)
+++ tor/trunk/ChangeLog	2008-11-11 15:29:40 UTC (rev 17244)
@@ -1,3 +1,9 @@
+Changes in version 0.2.1.8-alpha - 2008-??-??
+  o Minor bugfixes:
+    - Get file locking working on win32.  Bugfix on 0.2.1.6-alpha.  Fixes
+      bug 859.
+
+
 Changes in version 0.2.1.7-alpha - 2008-11-08
   o Security fixes:
     - The "ClientDNSRejectInternalAddresses" config option wasn't being

Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c	2008-11-11 14:43:36 UTC (rev 17243)
+++ tor/trunk/src/common/compat.c	2008-11-11 15:29:40 UTC (rev 17244)
@@ -508,7 +508,7 @@
   }
 #ifdef WIN32
   _lseek(fd, 0, SEEK_SET);
-  if (_locking(fd, blocking ? _LK_LOCK : _LK_NBLCK, 0) < 0) {
+  if (_locking(fd, blocking ? _LK_LOCK : _LK_NBLCK, 1) < 0) {
     if (errno != EDEADLOCK)
       log_warn(LD_FS,"Couldn't lock \"%s\": %s", filename, strerror(errno));
     else
@@ -542,7 +542,7 @@
   log_info(LD_FS, "Unlocking \"%s\"", lockfile->filename);
 #ifdef WIN32
   _lseek(lockfile->fd, 0, SEEK_SET);
-  if (_locking(lockfile->fd, _LK_UNLCK, 0) < 0) {
+  if (_locking(lockfile->fd, _LK_UNLCK, 1) < 0) {
     log_warn(LD_FS,"Error unlocking \"%s\": %s", lockfile->filename,
              strerror(errno));
   }



More information about the tor-commits mailing list