From ae63e1340448a2411875f795ff07332bb430b3cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 25 Nov 2019 17:54:07 -0500 Subject: [PATCH] Silence bogus warning when building with old GCC versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gcc version 7.4.0 (and possibly others) warn that `new_handle` may be used uninitialized. It is not clear what code path would trigger this uninitialized use. Moreover, the warning is not present when building with recent versions of gcc and clang, nor is it flagged by Coverity. This points to the warning being bogus. Still, setting `new_handle` to NULL silences the warning on this gcc version. Signed-off-by: Jérémie Galarneau --- tests/unit/test_fd_tracker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_fd_tracker.c b/tests/unit/test_fd_tracker.c index fe14e9c5c..a6a2a44d2 100644 --- a/tests/unit/test_fd_tracker.c +++ b/tests/unit/test_fd_tracker.c @@ -666,7 +666,7 @@ void test_unlink(void) char tmp_path_pattern[] = TMP_DIR_PATTERN; const char *output_dir; struct fs_handle *handles[handles_to_open]; - struct fs_handle *new_handle; + struct fs_handle *new_handle = NULL; char *file_path; char *unlinked_file_path; char *unlinked_file_path_suffix; -- 2.34.1