[njs] Fixed double close in njs_ftw() introduced in 5a80b43b7098.

Dmitry Volyntsev xeioex at nginx.com
Fri Aug 28 11:52:51 UTC 2020


details:   https://hg.nginx.org/njs/rev/0a5145a78a36
branches:  
changeset: 1510:0a5145a78a36
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Aug 28 11:47:50 2020 +0000
description:
Fixed double close in njs_ftw() introduced in 5a80b43b7098.

This correctly fixes Coverity CID 1465877.

diffstat:

 src/njs_fs.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r fa50cc5b1128 -r 0a5145a78a36 src/njs_fs.c
--- a/src/njs_fs.c	Thu Aug 27 14:43:23 2020 +0000
+++ b/src/njs_fs.c	Fri Aug 28 11:47:50 2020 +0000
@@ -1366,8 +1366,9 @@ njs_ftw(char *path, njs_file_tree_walk_c
             }
         }
 
-        closedir(d);
+        (void) closedir(d);
         d = NULL;
+        dfd = -1;
     }
 
     path[len] = '\0';


More information about the nginx-devel mailing list