58 lines
1.7 KiB
Diff
58 lines
1.7 KiB
Diff
|
From 3a058ce2f1febacf8aacde2b117cdfba291c95cf Mon Sep 17 00:00:00 2001
|
||
|
From: Hugo Mills <hugo@carfax.org.uk>
|
||
|
Date: Sun, 26 Jun 2011 19:41:18 +0100
|
||
|
Subject: [PATCH 27/28] mkfs.btrfs: Fix compilation errors with gcc 4.6
|
||
|
|
||
|
gcc 4.6 complains about several possible use-before-initialise cases
|
||
|
in mkfs, and stops. Fix these by initialising one of the variables in
|
||
|
question, and using the correct error-handling paths for the
|
||
|
remainder.
|
||
|
|
||
|
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
|
||
|
---
|
||
|
mkfs.c | 7 ++++---
|
||
|
1 files changed, 4 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/mkfs.c b/mkfs.c
|
||
|
index e191b7f..f2953db 100644
|
||
|
--- a/mkfs.c
|
||
|
+++ b/mkfs.c
|
||
|
@@ -750,7 +750,7 @@ static int add_file_items(struct btrfs_trans_handle *trans,
|
||
|
ino_t parent_inum, struct stat *st,
|
||
|
const char *path_name, int out_fd)
|
||
|
{
|
||
|
- int ret;
|
||
|
+ int ret = -1;
|
||
|
ssize_t ret_read;
|
||
|
u64 bytes_read = 0;
|
||
|
char *buffer = NULL;
|
||
|
@@ -889,7 +889,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
|
||
|
ret = btrfs_lookup_inode(trans, root, &path, &root_dir_key, 1);
|
||
|
if (ret) {
|
||
|
fprintf(stderr, "root dir lookup error\n");
|
||
|
- goto fail;
|
||
|
+ return -1;
|
||
|
}
|
||
|
|
||
|
leaf = path.nodes[0];
|
||
|
@@ -913,7 +913,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
|
||
|
if (chdir(parent_dir_entry->path)) {
|
||
|
fprintf(stderr, "chdir error for %s\n",
|
||
|
parent_dir_name);
|
||
|
- goto fail;
|
||
|
+ goto fail_no_files;
|
||
|
}
|
||
|
|
||
|
count = scandir(parent_dir_entry->path, &files,
|
||
|
@@ -996,6 +996,7 @@ static int traverse_directory(struct btrfs_trans_handle *trans,
|
||
|
return 0;
|
||
|
fail:
|
||
|
free_namelist(files, count);
|
||
|
+fail_no_files:
|
||
|
free(parent_dir_entry->path);
|
||
|
free(parent_dir_entry);
|
||
|
return -1;
|
||
|
--
|
||
|
1.7.5.2.353.g5df3e
|
||
|
|