]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_mdrestore: fix uninitialized variables in mdrestore main
authorDarrick J. Wong <djwong@kernel.org>
Wed, 20 Dec 2023 16:53:44 +0000 (08:53 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 22 Dec 2023 02:29:14 +0000 (18:29 -0800)
Coverity complained about the "is fd a file?" flags being uninitialized.
Clean this up.

Coverity-id: 1554270
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanbabu@kernel.org>
mdrestore/xfs_mdrestore.c

index 2de177c6e3f1a76edaef87d2246bfe473018a075..5dfc423493e2c02011af222b2f344ac45eba28ca 100644 (file)
@@ -472,11 +472,11 @@ main(
        union mdrestore_headers headers;
        FILE                    *src_f;
        char                    *logdev = NULL;
-       int                     data_dev_fd;
-       int                     log_dev_fd;
+       int                     data_dev_fd = -1;
+       int                     log_dev_fd = -1;
        int                     c;
-       bool                    is_data_dev_file;
-       bool                    is_log_dev_file;
+       bool                    is_data_dev_file = false;
+       bool                    is_log_dev_file = false;
 
        mdrestore.show_progress = false;
        mdrestore.show_info = false;
@@ -561,7 +561,6 @@ main(
        /* check and open data device */
        data_dev_fd = open_device(argv[optind], &is_data_dev_file);
 
-       log_dev_fd = -1;
        if (mdrestore.external_log)
                /* check and open log device */
                log_dev_fd = open_device(logdev, &is_log_dev_file);