From cc542ca566355d8dd71bca62e3c564243120455e Mon Sep 17 00:00:00 2001 From: Michal Zidek Date: Fri, 25 Jan 2013 16:41:07 +0100 Subject: Unchecked return value in files.c Found by coverity. https://fedorahosted.org/sssd/ticket/1791 --- src/tools/files.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/files.c b/src/tools/files.c index 62fd0036..57261729 100644 --- a/src/tools/files.c +++ b/src/tools/files.c @@ -691,6 +691,7 @@ copy_dir(struct copy_ctx *cctx, const struct stat *src_dir_stat) { errno_t ret; + errno_t dret; int dest_dir_fd = -1; DIR *dir = NULL; struct dirent *ent; @@ -779,7 +780,14 @@ copy_dir(struct copy_ctx *cctx, ret = EOK; done: - if (dir) closedir(dir); + if (dir) { + dret = closedir(dir); + if (dret != 0) { + dret = errno; + DEBUG(SSSDBG_MINOR_FAILURE, + ("Failed to close directory: %s.\n", strerror(dret))); + } + } if (dest_dir_fd != -1) { close(dest_dir_fd); -- cgit