From: Francis Deslauriers Date: Mon, 16 Sep 2019 14:46:31 +0000 (-0400) Subject: Fix: test_dwarf.c: close() argument cannot be negative X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=eda096d774a5c41bcbc0c54846c716f8aeb6ad99 Fix: test_dwarf.c: close() argument cannot be negative Coverity reported the following: CID 1401801 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)8. negative_returns: fd is passed to a parameter that cannot be negative. Reported-by: Coverity - Argument cannot be negative (NEGATIVE_RETURNS) Signed-off-by: Francis Deslauriers Change-Id: Ibcdcfd54f5f711923e5a31544c86e82da3ec6226 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2048 Tested-by: jenkins Reviewed-by: Simon Marchi --- diff --git a/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c b/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c index 953556c4..01a7b517 100644 --- a/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c +++ b/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c @@ -63,7 +63,10 @@ void test_bt_no_dwarf(const char *data_dir) if (dwarf_info) { dwarf_end(dwarf_info); } - close(fd); + + if (fd >= 0) { + close(fd); + } g_free(path); }