From: Volker Lendecke Date: Sat, 8 Sep 2018 11:44:30 +0000 (+0200) Subject: smbd: Simplify close_directory() X-Git-Tag: tdb-1.3.17~1655 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd89034f6d2a33b3b106046011b90db3c1ae1423;p=thirdparty%2Fsamba.git smbd: Simplify close_directory() Same patch as in 8541829a9ab20c7fa8c Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 7820fff3519..288415a21b2 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1153,23 +1153,27 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, * case, then don't delete. If all opens are POSIX delete now. */ for (i=0; idata->num_share_modes; i++) { struct share_mode_entry *e = &lck->data->share_modes[i]; - if (is_valid_share_mode_entry(e) && - e->name_hash == fsp->name_hash) { - if ((fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) && - (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) - { - continue; - } - if (serverid_equal(&self, &e->pid) && - (e->share_file_id == fsp->fh->gen_id)) { - continue; - } - if (share_mode_stale_pid(lck->data, i)) { - continue; - } - delete_dir = False; - break; + + if (!is_valid_share_mode_entry(e)) { + continue; + } + if (e->name_hash != fsp->name_hash) { + continue; } + if ((fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) && + (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) + { + continue; + } + if (serverid_equal(&self, &e->pid) && + (e->share_file_id == fsp->fh->gen_id)) { + continue; + } + if (share_mode_stale_pid(lck->data, i)) { + continue; + } + delete_dir = False; + break; } }