aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-02-05 14:37:42 -0600
committerEric Sandeen <sandeen@redhat.com>2018-02-05 14:37:42 -0600
commite91c285f92cc1028f17833f9773ddc5c9905c804 (patch)
treed15dc4f3198b61691314aec301e467c79710c3b1
parentbfa66ecdb675afbf00d48c70cf5d53af383f27f0 (diff)
downloadxfsprogs-dev-e91c285f92cc1028f17833f9773ddc5c9905c804.tar.gz
xfs_scrub: close dir_fd if we don't get a DIR pointer
If we don't get a directory pointer, close dir_fd before jumping out. Fixes-coverity-id: 1428799 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--scrub/vfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/scrub/vfs.c b/scrub/vfs.c
index e3c8e62c64..573a2d0dcd 100644
--- a/scrub/vfs.c
+++ b/scrub/vfs.c
@@ -88,6 +88,7 @@ scan_fs_dir(
/* Caller-specific directory checks. */
if (!sft->dir_fn(ctx, sftd->path, dir_fd, sft->arg)) {
sft->moveon = false;
+ close(dir_fd);
goto out;
}
@@ -95,6 +96,7 @@ scan_fs_dir(
dir = fdopendir(dir_fd);
if (!dir) {
str_errno(ctx, sftd->path);
+ close(dir_fd);
goto out;
}
rewinddir(dir);