]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_shadow_copy2: Avoid closing snapsdir twice
authorAnoop C S <anoopcs@samba.org>
Mon, 12 Oct 2020 11:25:40 +0000 (16:55 +0530)
committerRalph Boehme <slow@samba.org>
Wed, 14 Oct 2020 10:08:24 +0000 (10:08 +0000)
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 <jra@samba.org>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Oct 14 10:08:24 UTC 2020 on sn-devel-184

source3/modules/vfs_shadow_copy2.c

index 5081e37c05ef7cdc7a976743e3a461585011e9fd..0780895b0dd5359d7499cd707afc579feeb9ffff 100644 (file)
@@ -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);