Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/37480 )
Change subject: Run closedir() only if opendir() succeeded ......................................................................
Run closedir() only if opendir() succeeded
Otherwise we operate on a non-existing DIR * handle.
Change-Id: Ib977b50cb61b5b396ecbc2d911a0876518115a81 Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M em100.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/80/37480/1
diff --git a/em100.c b/em100.c index ea93520..25d9732 100644 --- a/em100.c +++ b/em100.c @@ -720,7 +720,8 @@
DIR *dir = opendir(directory); if (dir) { - // success + /* success */ + closedir(dir); } else if (errno == ENOENT) { if (mkdir(directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { perror(directory); @@ -733,7 +734,6 @@ return NULL; }
- closedir(dir); return directory; }