From: Francis Deslauriers Date: Tue, 1 Oct 2019 13:43:03 +0000 (-0400) Subject: Fix: common: Unchecked return value of `closedir()` X-Git-Tag: v2.12.0-rc1~335 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=41066401b61b30ba9718a56e2fe87713a8e2fb71;p=lttng-tools.git Fix: common: Unchecked return value of `closedir()` Coverity report: CID 1404930 (#1 of 1): Unchecked return value (CHECKED_RETURN)1. check_return: Calling closedir without checking return value (as is done elsewhere 5 out of 6 times). Reported-by: Coverity (1404930) Unchecked return value Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/compat/directory-handle.c b/src/common/compat/directory-handle.c index 4dad7b757..95be9ec3d 100644 --- a/src/common/compat/directory-handle.c +++ b/src/common/compat/directory-handle.c @@ -1069,9 +1069,13 @@ struct rmdir_frame { static void rmdir_frame_fini(void *data) { + int ret; struct rmdir_frame *frame = data; - closedir(frame->dir); + ret = closedir(frame->dir); + if (ret == -1) { + PERROR("Failed to close directory stream"); + } } static