summaryrefslogtreecommitdiffstats
path: root/source/locking/posix.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-12 20:40:29 +0000
committerJeremy Allison <jra@samba.org>2003-02-12 20:40:29 +0000
commite9b4fb8b9aedda9afc01af976264298002be3096 (patch)
treeeea0032d132a24fea37a6699d1fbbd461f5cb134 /source/locking/posix.c
parent2fa33fcaee288f0607db9fc72d2f1cafdd6c5959 (diff)
downloadsamba-e9b4fb8b9aedda9afc01af976264298002be3096.tar.gz
samba-e9b4fb8b9aedda9afc01af976264298002be3096.tar.xz
samba-e9b4fb8b9aedda9afc01af976264298002be3096.zip
Fixes for HPUX only having limited POSIX lock range from Michael Steffens <michael.steffens@hp.com>
Jeremy.
Diffstat (limited to 'source/locking/posix.c')
-rw-r--r--source/locking/posix.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/source/locking/posix.c b/source/locking/posix.c
index fcf19d21cfe..2b64631d39a 100644
--- a/source/locking/posix.c
+++ b/source/locking/posix.c
@@ -552,7 +552,11 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
* find the maximum positive lock offset as an SMB_OFF_T.
*/
-#if defined(LARGE_SMB_OFF_T) && !defined(HAVE_BROKEN_FCNTL64_LOCKS)
+#if defined(MAX_POSITIVE_LOCK_OFFSET) /* Some systems have arbitrary limits. */
+
+ SMB_OFF_T max_positive_lock_offset = (MAX_POSITIVE_LOCK_OFFSET);
+
+#elif defined(LARGE_SMB_OFF_T) && !defined(HAVE_BROKEN_FCNTL64_LOCKS)
/*
* In this case SMB_OFF_T is 64 bits,
@@ -598,19 +602,10 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
}
/*
- * We must truncate the offset and count to less than max_positive_lock_offset.
- */
-
- offset &= max_positive_lock_offset;
- count &= max_positive_lock_offset;
-
-
- /*
- * Deal with a very common case of count of all ones.
- * (lock entire file).
+ * We must truncate the count to less than max_positive_lock_offset.
*/
- if(count == (SMB_OFF_T)-1)
+ if (u_count & ~((SMB_BIG_UINT)max_positive_lock_offset))
count = max_positive_lock_offset;
/*