summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-02-08 15:05:00 -0800
committerJeremy Allison <jra@samba.org>2011-02-08 15:06:00 -0800
commit224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1 (patch)
treec7729d94124f674ce87419a8ff6b758b00cde445 /source3/smbd/dir.c
parentad3d1adea3cdf42aee644dd853193b53a142c2f1 (diff)
downloadsamba-224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1.tar.gz
samba-224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1.tar.bz2
samba-224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1.zip
Pass fsp to dptr_CloseDir(). Cope with setting the fd if we're closing an fd that opendir knows about.
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c12
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)