diff options
-rw-r--r-- | source/smbd/files.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/smbd/files.c b/source/smbd/files.c index 13e6dd9b288..d6e91c67be1 100644 --- a/source/smbd/files.c +++ b/source/smbd/files.c @@ -326,7 +326,8 @@ files_struct *file_find_di_first(struct file_id id) fsp_fi_cache.id = id; for (fsp=Files;fsp;fsp=fsp->next) { - if (file_id_equal(&fsp->file_id, &id)) { + if ( fsp->fh->fd != -1 && + file_id_equal(&fsp->file_id, &id)) { /* Setup positive cache. */ fsp_fi_cache.fsp = fsp; return fsp; @@ -347,7 +348,8 @@ files_struct *file_find_di_next(files_struct *start_fsp) files_struct *fsp; for (fsp = start_fsp->next;fsp;fsp=fsp->next) { - if (file_id_equal(&fsp->file_id, &start_fsp->file_id)) { + if ( fsp->fh->fd != -1 && + file_id_equal(&fsp->file_id, &start_fsp->file_id)) { return fsp; } } |