From 8d96eb3666ce2e0f016068dfae60eb32ed2b518e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Apr 2013 16:29:03 -0700 Subject: [PATCH] Remove the "Ugly hack" that was the second use of dirfd(). The destructor does all the resource deallocation needed. Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider (cherry picked from commit 0fe894fb89f4867e266bb04670a58101311e0234) --- source3/smbd/dir.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 19f07f34003..fe643ade8aa 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -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; } } -- 2.11.4.GIT