Fix: test_dwarf.c: close() argument cannot be negative
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 16 Sep 2019 14:46:31 +0000 (10:46 -0400)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 19 Sep 2019 18:41:56 +0000 (14:41 -0400)
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 <francis.deslauriers@efficios.com>
Change-Id: Ibcdcfd54f5f711923e5a31544c86e82da3ec6226
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2048
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c

index 953556c41004cf43341d01f25fdacb5dbd397e2a..01a7b5172500d0a1716dd6e038420f8b88eccac6 100644 (file)
@@ -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);
 }
 
This page took 0.024287 seconds and 4 git commands to generate.