diff mbox series

[2/3] libtracefs utest: Fix a sometimes uninitialized variable.

Message ID 20210423035438.2221760-2-irogers@google.com (mailing list archive)
State Accepted
Commit a36a5c952d5b7671b574ae5ce8c3673369bd9e38
Headers show
Series [1/3] libtracefs utest: Silence string-plus-int warnings | expand

Commit Message

Ian Rogers April 23, 2021, 3:54 a.m. UTC
The warning looks like:

utest/tracefs-utest.c:706:7: error: variable 'fd' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (rstat != -1)
                    ^~~~~~~~~~~

Signed-off-by: Ian Rogers <irogers@google.com>
---
 utest/tracefs-utest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index c5efd5f..a0d911b 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -659,7 +659,7 @@  static bool check_option(struct tracefs_instance *instance,
 	bool supported;
 	struct stat st;
 	char buf[10];
-	int fd;
+	int fd = 0;
 	int r;
 	int rstat;