[syslinux:master] rosh: closedir() only if actually opened

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Sun Nov 14 12:54:41 PST 2010


Commit-ID:  b3b0fa7ce9bcdc6c5f25ef9ed47dab23ac4c8d01
Gitweb:     http://syslinux.zytor.com/commit/b3b0fa7ce9bcdc6c5f25ef9ed47dab23ac4c8d01
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Sat, 2 Oct 2010 00:18:27 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sat, 9 Oct 2010 07:33:07 -0400

rosh: closedir() only if actually opened



---
 com32/rosh/rosh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index f5ed6cd..8d063e6 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -780,11 +780,11 @@ void rosh_ls_arg(const char *filestr, const int *optarr)
 	    ROSH_DEBUG("PATH '%s' is a directory\n", filestr);
 	    if (d = opendir(filestr)) {
 		rosh_ls_arg_dir(filestr, d, optarr);
+		closedir(d);
 	    } else {
 		rosh_error(errno, "ls", filestr);
 		errno = 0;
 	    }
-	    closedir(d);
 	} else {
 	    de.d_ino = rosh_ls_d_ino(&fdstat);
 	    de.d_type = (IFTODT(fdstat.st_mode));



More information about the Syslinux-commits mailing list