From: Anoop C S Date: Fri, 27 Jul 2018 06:20:39 +0000 (+0530) Subject: s3/locking: Fix assertion check on lock reference count X-Git-Tag: ldb-1.5.0~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80c9219d6079532f31c4e415906a606d395af6e8;p=thirdparty%2Fsamba.git s3/locking: Fix assertion check on lock reference count lock_ref_count will always hold the old value prior to change. Thus it would mean that if lock_ref_count is 0 the new value is already -1 which is not expected here. Therefore it is better to make sure that it is always greater than 0 rather than >= 0. Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison Reviewed-by: Andreas Schneider Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Jul 31 04:23:47 CEST 2018 on sn-devel-144 --- diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 0b627aaa3e5..13992663280 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -454,7 +454,7 @@ static void decrement_lock_ref_count(const files_struct *fsp) &lock_ref_count, -1); SMB_ASSERT(NT_STATUS_IS_OK(status)); - SMB_ASSERT(lock_ref_count >= 0); + SMB_ASSERT(lock_ref_count > 0); DEBUG(10,("lock_ref_count for file %s = %d\n", fsp_str_dbg(fsp), (int)lock_ref_count));