summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-11 15:29:40 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-11 15:29:40 +0000
commita95e0e73559349fbbcd97c183ffd481616cbfd5e (patch)
tree560ab3ac26dafa3150ced47df3b17a82298734d2 /src
parentd54fbdb53139ff8a327aa08135a051efc653df6e (diff)
downloadtor-a95e0e73559349fbbcd97c183ffd481616cbfd5e.tar.gz
tor-a95e0e73559349fbbcd97c183ffd481616cbfd5e.zip
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. )
svn:r17244
Diffstat (limited to 'src')
-rw-r--r--src/common/compat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index b3d4361969..5a3858ef8a 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -508,7 +508,7 @@ tor_lockfile_lock(const char *filename, int blocking, int *locked_out)
}
#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 @@ tor_lockfile_unlock(tor_lockfile_t *lockfile)
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));
}