From: Anoop C S Date: Mon, 12 Oct 2020 11:25:40 +0000 (+0530) Subject: vfs_shadow_copy2: Avoid closing snapsdir twice X-Git-Tag: talloc-2.3.2~270 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74fbe0b987a0333cca28bb6a547e5b4b4f2e706d;p=thirdparty%2Fsamba.git vfs_shadow_copy2: Avoid closing snapsdir twice As per man page for closedir(3): . . . The closedir() function closes the directory stream associated with dirp. A successful call to closedir() also closes the underlying file descriptor associated with dirp. . . . Therefore we don't have to attempt an additional close of file descriptor after closedir(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14530 Signed-off-by: Jeremy Allison Signed-off-by: Anoop C S Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Wed Oct 14 10:08:24 UTC 2020 on sn-devel-184 --- diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 5081e37c05e..0780895b0dd 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -2116,6 +2116,13 @@ done: if (p != NULL) { SMB_VFS_NEXT_CLOSEDIR(handle, p); p = NULL; + if (dirfsp != NULL) { + /* + * VFS_CLOSEDIR implicitly + * closed the associated fd. + */ + dirfsp->fh->fd = -1; + } } if (dirfsp != NULL) { fd_close(dirfsp);