]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: don't close mnt_fd when mnt_fd open fails
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 28 Mar 2019 23:05:01 +0000 (18:05 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 28 Mar 2019 23:05:01 +0000 (18:05 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/phase1.c

index 6b472147f866386f17acb039ff4f25d6bae0d9eb..04a5f4a9209924b5e23ea4dd7b07229407567fae 100644 (file)
@@ -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;