diff options
author | Jeremy Allison <jra@samba.org> | 2006-07-15 00:34:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:19:22 -0500 |
commit | 354e444ee3dcd5745d94d299edef4726941efb8f (patch) | |
tree | 38cad5a90f4b9a6af6a88fd15f1db4d3bf928669 | |
parent | ad673ea988cdfe2b596f128e616f7cd57fedf33d (diff) | |
download | samba-354e444ee3dcd5745d94d299edef4726941efb8f.tar.gz samba-354e444ee3dcd5745d94d299edef4726941efb8f.tar.bz2 samba-354e444ee3dcd5745d94d299edef4726941efb8f.zip |
r17046: Ensure we're using the right pointers ...
Jeremy.
(This used to be commit a8df1863bf2817a82a55c816ba1f685828c5b6ec)
-rw-r--r-- | source3/locking/brlock.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index c048ef3005..9edac7203b 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -723,7 +723,7 @@ NTSTATUS brl_lock(struct byte_range_lock *br_lck, Check if an unlock overlaps a pending lock. ****************************************************************************/ -static BOOL brl_pending_overlap(struct lock_struct *lock, struct lock_struct *pend_lock) +static BOOL brl_pending_overlap(const struct lock_struct *lock, const struct lock_struct *pend_lock) { if ((lock->start <= pend_lock->start) && (lock->start + lock->size > pend_lock->start)) return True; @@ -739,7 +739,6 @@ static BOOL brl_pending_overlap(struct lock_struct *lock, struct lock_struct *pe static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock_struct *plock) { unsigned int i, j; - struct lock_struct *lock = NULL; struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data; enum brl_type deleted_lock_type = READ_LOCK; /* shut the compiler up.... */ @@ -748,7 +747,7 @@ static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock is sorted in the zero zero case. */ for (i = 0; i < br_lck->num_locks; i++) { - lock = &locks[i]; + struct lock_struct *lock = &locks[i]; if (lock->lock_type == WRITE_LOCK && brl_same_context(&lock->context, &plock->context) && @@ -770,7 +769,7 @@ static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock #endif for (i = 0; i < br_lck->num_locks; i++) { - lock = &locks[i]; + struct lock_struct *lock = &locks[i]; /* Only remove our own locks that match in start, size, and flavour. */ if (brl_same_context(&lock->context, &plock->context) && @@ -822,7 +821,7 @@ static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock } /* We could send specific lock info here... */ - if (brl_pending_overlap(lock, pend_lock)) { + if (brl_pending_overlap(plock, pend_lock)) { DEBUG(10,("brl_unlock: sending unlock message to pid %s\n", procid_str_static(&pend_lock->context.pid ))); @@ -844,7 +843,6 @@ static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_struct *plock) { unsigned int i, j, count; - struct lock_struct *lock = NULL; struct lock_struct *tp; struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data; BOOL overlap_found = False; @@ -873,12 +871,11 @@ static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_s count = 0; for (i = 0; i < br_lck->num_locks; i++) { + struct lock_struct *lock = &locks[i]; struct lock_struct tmp_lock[3]; BOOL lock_was_added = False; unsigned int tmp_count; - lock = &locks[i]; - /* Only remove our own locks - ignore fnum. */ if (lock->lock_type == PENDING_LOCK || !brl_same_context(&lock->context, &plock->context)) { @@ -979,11 +976,10 @@ static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_s br_lck->num_locks = count; SAFE_FREE(br_lck->lock_data); - br_lck->lock_data = (void *)tp; + locks = br_lck->lock_data = (void *)tp; br_lck->modified = True; /* Send unlock messages to any pending waiters that overlap. */ - locks = tp; for (j=0; j < br_lck->num_locks; j++) { struct lock_struct *pend_lock = &locks[j]; @@ -994,7 +990,7 @@ static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_s } /* We could send specific lock info here... */ - if (brl_pending_overlap(lock, pend_lock)) { + if (brl_pending_overlap(plock, pend_lock)) { DEBUG(10,("brl_unlock: sending unlock message to pid %s\n", procid_str_static(&pend_lock->context.pid ))); |