The key was allowing the dptr_idle code to be triggered. We were
closing the dirp->dir handle without updating the underlying fd
in the open fsp.
Jeremy.
* present. I hate Solaris. JRA.
*/
#ifdef HAVE_DIRFD
- if (fsp->fh->fd == dirfd(fsp->dptr->dir_hnd->dir)) {
+ 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;
}
static int smb_Dir_destructor(struct smb_Dir *dirp)
{
if (dirp->dir) {
+#ifdef HAVE_DIRFD
+ if (dirp->conn->sconn) {
+ files_struct *fsp = file_find_fd(dirp->conn->sconn,
+ dirfd(dirp->dir));
+ if (fsp) {
+ /* The call below closes the underlying fd. */
+ fsp->fh->fd = -1;
+ }
+ }
+#endif
SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir);
}
if (dirp->conn->sconn) {