diff mbox

[v2,9/9] mkfs.btrfs: fix error text in '-r' mode

Message ID 1307175564-25355-10-git-send-email-slyfox@gentoo.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sergei Trofimovich June 4, 2011, 8:19 a.m. UTC
Smart gcc noticed use of uninitialized warning when compiled
with -O0 flags:

    mkfs.c:1291: error: 'file' may be used uninitialized in this function

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 mkfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/mkfs.c b/mkfs.c
index a65fb4d..44a05e8 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1272,47 +1272,47 @@  int main(int ac, char **av)
 			fprintf(stderr, "error checking %s mount status\n", file);
 			exit(1);
 		}
 		if (ret == 1) {
 			fprintf(stderr, "%s is mounted\n", file);
 			exit(1);
 		}
 		ac--;
 		fd = open(file, O_RDWR);
 		if (fd < 0) {
 			fprintf(stderr, "unable to open %s\n", file);
 			exit(1);
 		}
 		first_fd = fd;
 		first_file = file;
 		ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count, &mixed);
 		if (block_count == 0)
 			block_count = dev_block_count;
 	} else {
 		ac = 0;
+		file = output;
 		fd = open_target(output);
 		if (fd < 0) {
 			fprintf(stderr, "unable to open the %s\n", file);
 			exit(1);
 		}
 
-		file = output;
 		first_fd = fd;
 		first_file = file;
 		block_count = size_sourcedir(source_dir, sectorsize,
 					     &num_of_meta_chunks, &size_of_data);
 		ret = zero_output_file(fd, block_count, sectorsize);
 		if (ret) {
 			fprintf(stderr, "unable to zero the output file\n");
 			exit(1);
 		}
 	}
 	if (mixed) {
 		if (!metadata_profile_opt)
 			metadata_profile = 0;
 		if (!data_profile_opt)
 			data_profile = 0;
 
 		if (metadata_profile != data_profile) {
 			fprintf(stderr, "With mixed block groups data and metadata "
 				"profiles must be the same\n");
 			exit(1);