summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-10-02 12:42:43 +0000
committerGitHub <noreply@github.com>2019-10-02 12:42:43 +0000
commit7a925658cf087cddd20852449e20002bfbd52774 (patch)
tree08a9e156eca27dd810996ba576d70d682909131b
parent4d6fd4da0861d2823f2e451feb7180f363e88486 (diff)
parent27f903039d164c6ee47f16b2a56d59bb8bf57a50 (diff)
downloadgenimage-7a925658cf087cddd20852449e20002bfbd52774.tar.gz
genimage-7a925658cf087cddd20852449e20002bfbd52774.tar.xz
Merge pull request #76 from hcodina/master
Error `Too many open files`
-rw-r--r--util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util.c b/util.c
index b1ec96f..42ee661 100644
--- a/util.c
+++ b/util.c
@@ -729,6 +729,7 @@ static unsigned long long dir_size(struct image *image, int dirfd,
if (dir == NULL) {
image_error(image, "failed to opendir '%s': %s", subdir,
strerror(errno));
+ close(fd);
return 0;
}
while ((d = readdir(dir)) != NULL) {
@@ -748,6 +749,8 @@ static unsigned long long dir_size(struct image *image, int dirfd,
}
size += ROUND_UP(st.st_size, blocksize);
}
+ closedir(dir);
+ close(fd);
return size + blocksize;
}