commit 61cd0f8041e36757f4a02aa8894309412e35ccff parent bc2d9e7c11f010e3f2c8ccf6d9a082aafc1a98b8 Author: sin <sin@2f30.org> Date: Fri, 10 Oct 2014 10:12:01 +0100 Only closedir when dirp is valid Diffstat:
M | noice.c | | | 8 | +++++--- |
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/noice.c b/noice.c @@ -552,9 +552,11 @@ out: free(dents[i].name); free(dents); - r = closedir(dirp); - if (r == -1) - printerr(1, "closedir"); + if (dirp != NULL) { + r = closedir(dirp); + if (r == -1) + printerr(1, "closedir"); + } goto begin; }