From: Darrick J. Wong Date: Thu, 28 Mar 2019 23:05:01 +0000 (-0500) Subject: xfs_scrub: don't close mnt_fd when mnt_fd open fails X-Git-Tag: libxfs-5.1-sync_2019-04-10~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa26c33ced2d85e02c130882061228f18440b83f;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: don't close mnt_fd when mnt_fd open fails If we fail to open the mountpoint during phase 1 of scrub, don't bother trying to close the file descriptor since it's silly to spray error messages about that. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/scrub/phase1.c b/scrub/phase1.c index 6b472147f..04a5f4a92 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -59,9 +59,11 @@ xfs_cleanup_fs( if (ctx->datadev) disk_close(ctx->datadev); fshandle_destroy(); - error = close(ctx->mnt_fd); - if (error) - str_errno(ctx, _("closing mountpoint fd")); + if (ctx->mnt_fd >= 0) { + error = close(ctx->mnt_fd); + if (error) + str_errno(ctx, _("closing mountpoint fd")); + } fs_table_destroy(); return true;