Remove the "Ugly hack" that was the second use of dirfd().
authorJeremy Allison <jra@samba.org>
Wed, 10 Apr 2013 23:29:03 +0000 (16:29 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 5 Jun 2013 10:02:42 +0000 (12:02 +0200)
The destructor does all the resource deallocation needed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0fe894fb89f4867e266bb04670a58101311e0234)

source3/smbd/dir.c

index 19f07f340034fa6502ec0674606ffde459faeb63..fe643ade8aabf56718166a7586bc49295dacea81 100644 (file)
@@ -592,20 +592,12 @@ done:
 void dptr_CloseDir(files_struct *fsp)
 {
        if (fsp->dptr) {
-/*
- * Ugly hack. We have defined fdopendir to return ENOSYS if dirfd also isn't
- * present. I hate Solaris. JRA.
- */
-#ifdef HAVE_DIRFD
-               if (fsp->fh->fd != -1 &&
-                               fsp->dptr->dir_hnd &&
-                               dirfd(fsp->dptr->dir_hnd->dir)) {
-                       /* The call below closes the underlying fd. */
-                       fsp->fh->fd = -1;
-               }
-#endif
+               /*
+                * The destructor for the struct smb_Dir
+                * (fsp->dptr->dir_hnd) now handles
+                * all resource deallocation.
+                */
                dptr_close_internal(fsp->dptr);
-               fsp->dptr = NULL;
        }
 }