Skip to contentSkip to conversation

btrfs-progs: fix compiler warning

PATCH New Christian Hesse 1 participant 1 message Jun 5, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: fix compiler warning

gcc 4.9.0 gives warnings about possibly uninitialized values when compiling with function inlining and optimization level two enabled (CFLAGS="-finline-functions -O2").

Initializing the values fixes the warning. Hope this is correct.

---
 cmds-send.c   | 2 +-
 send-stream.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
cmds-send.c +1 -1
index 1cd457d..0c3e96b 100644
@@ -416,7 +416,7 @@ int cmd_send(int argc, char **argv)
 	u32 i;
 	char *mount_root = NULL;
 	char *snapshot_parent = NULL;
-	u64 root_id;
+	u64 root_id = 0;
 	u64 parent_root_id = 0;
 	int full_send = 1;
 	int new_end_cmd_semantic = 0;
send-stream.c +1 -1
index 88e18e2..54edafe 100644
@@ -216,7 +216,7 @@ static int tlv_get_string(struct btrfs_send_stream *s, int attr, char **str)
 {
 	int ret;
 	void *data;
-	int len;
+	int len = 0;
 
 	TLV_GET(s, attr, &data, &len);
 
Signature · 1 line
2.0.0