Fix: common: Unchecked return value of `closedir()`
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 1 Oct 2019 13:43:03 +0000 (09:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Oct 2019 01:48:47 +0000 (21:48 -0400)
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 <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/compat/directory-handle.c

index 4dad7b75744a7d81305910a3d86556cca3179bf1..95be9ec3d7cfeada460dad1238e1ca06dac53695 100644 (file)
@@ -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
This page took 0.026049 seconds and 4 git commands to generate.