From: Volker Lendecke Date: Tue, 10 Dec 2019 13:41:57 +0000 (+0100) Subject: smbd: Avoid a reference to share_mode_data->num_share_modes X-Git-Tag: ldb-2.1.0~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0df06f51ffbc200b0525e175e7ac58795fd93bab;p=thirdparty%2Fsamba.git smbd: Avoid a reference to share_mode_data->num_share_modes share_mode_data->num_share_modes will go away soon, count the values directly while walking the array. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 58c7c8d3038..842d7d5df0c 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -1197,6 +1197,7 @@ int share_entry_forall(int (*fn)(struct file_id fid, struct cleanup_disconnected_state { struct share_mode_lock *lck; uint64_t open_persistent_id; + size_t num_disconnected; bool found_connected; }; @@ -1265,6 +1266,8 @@ static bool share_mode_find_connected_fn( return true; } + state->num_disconnected += 1; + return false; } @@ -1334,11 +1337,11 @@ bool share_mode_cleanup_disconnected(struct file_id fid, goto done; } - DBG_DEBUG("cleaning up %u entries for file " + DBG_DEBUG("cleaning up %zu entries for file " "(file-id='%s', servicepath='%s', " "base_name='%s%s%s') " "from open_persistent_id %"PRIu64"\n", - data->num_share_modes, + state.num_disconnected, file_id_str_buf(fid, &idbuf), data->servicepath, data->base_name,