aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
authorSowrabha Gopal <[email protected]>2017-06-01 13:27:02 -0700
committerBrian Behlendorf <[email protected]>2017-06-30 11:11:01 -0700
commitaa6e82a6a55d6fde7a8dc1c21bf952df69ef9a20 (patch)
tree4204240857983b457e4ff118d87d13cd95c0c343 /lib/libzfs
parent1579dcbc9176d3875f3ce8926076e46a87d8e8ed (diff)
OpenZFS 8430 - dir_is_empty_readdir() doesn't properly handle error from fdopendir()
Authored by: Sowrabha Gopal <[email protected]> Reviewed by: Serapheim Dimitropoulos <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: Yuri Pankov <[email protected]> Reviewed by: Igor Kozhukhov <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> 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
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_mount.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index 6296eb13a..a66278627 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -210,6 +210,7 @@ dir_is_empty_readdir(const char *dirname)
}
if ((dirp = fdopendir(dirfd)) == NULL) {
+ (void) close(dirfd);
return (B_TRUE);
}