]> granicus.if.org Git - zfs/commitdiff
OpenZFS 8430 - dir_is_empty_readdir() doesn't properly handle error from fdopendir()
authorSowrabha Gopal <sowrabha.gopal@delphix.com>
Thu, 1 Jun 2017 20:27:02 +0000 (13:27 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 30 Jun 2017 18:11:01 +0000 (11:11 -0700)
Authored by: Sowrabha Gopal <sowrabha.gopal@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov>
dir_is_empty_readdir() immediately returns if fdopendir() fails.
We should close dirfd when that happens.

OpenZFS-issue: https://www.illumos.org/issues/8430
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/e165e20
Closes #6289

lib/libzfs/libzfs_mount.c

index 6296eb13a7d0679fd090ca7ea946dfc54f408fb4..a66278627134a5426a69c93775d801fb0904735d 100644 (file)
@@ -210,6 +210,7 @@ dir_is_empty_readdir(const char *dirname)
        }
 
        if ((dirp = fdopendir(dirfd)) == NULL) {
+               (void) close(dirfd);
                return (B_TRUE);
        }