1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

s3: smbd: Use a separate simple destructor for the OpenDir() codepath.

This will help greatly in understanding the code changes later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Jeremy Allison 2019-07-17 09:31:46 -07:00 committed by Andreas Schneider
parent d144108972
commit eb5fa8ac84

View File

@ -1674,6 +1674,18 @@ static struct smb_Dir *open_dir_safely(TALLOC_CTX *ctx,
return dir_hnd;
}
/*
* Simple destructor for OpenDir() use. Don't need to
* care about fsp back pointer as we know we have never
* set it in the OpenDir() code path.
*/
static int smb_Dir_OpenDir_destructor(struct smb_Dir *dir_hnd)
{
SMB_VFS_CLOSEDIR(dir_hnd->conn, dir_hnd->dir);
return 0;
}
struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
const struct smb_filename *smb_dname,
const char *mask,
@ -1687,7 +1699,7 @@ struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
if (dir_hnd == NULL) {
return NULL;
}
talloc_set_destructor(dir_hnd, smb_Dir_destructor);
talloc_set_destructor(dir_hnd, smb_Dir_OpenDir_destructor);
return dir_hnd;
}