diff options
author | Herve Codina <herve.codina@celad.com> | 2019-10-02 12:12:55 +0200 |
---|---|---|
committer | Herve Codina <herve.codina.external@spherea.com> | 2019-10-02 13:31:54 +0200 |
commit | 27f903039d164c6ee47f16b2a56d59bb8bf57a50 (patch) | |
tree | 08a9e156eca27dd810996ba576d70d682909131b | |
parent | 4d6fd4da0861d2823f2e451feb7180f363e88486 (diff) | |
download | genimage-27f903039d164c6ee47f16b2a56d59bb8bf57a50.tar.gz genimage-27f903039d164c6ee47f16b2a56d59bb8bf57a50.tar.xz |
dir_size: close fd and dir when no longer used
Signed-off-by: Herve Codina <herve.codina@celad.com>
-rw-r--r-- | util.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; } |