diff options
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r-- | source3/smbd/dir.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 7c9d6e262e..f81206e0ec 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -554,10 +554,16 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, Wrapper functions to access the lower level directory handles. ****************************************************************************/ -int dptr_CloseDir(struct dptr_struct *dptr) +void dptr_CloseDir(files_struct *fsp) { - dptr_close_internal(dptr); - return 0; + if (fsp->dptr) { + if (fsp->fh->fd == dirfd(fsp->dptr->dir_hnd->dir)) { + /* The call below closes the underlying fd. */ + fsp->fh->fd = -1; + } + dptr_close_internal(fsp->dptr); + fsp->dptr = NULL; + } } void dptr_SeekDir(struct dptr_struct *dptr, long offset) |