Fix double close in GetTreeBytes.

calculate_dir_size closes the fd that it receives.

Bug: http://b/80446935
Test: treehugger
Change-Id: I56a428cd7eb78e56c55434628c1c7b2b87637c81
This commit is contained in:
Josh Gao 2018-05-29 19:05:16 -07:00
parent 6054bc3ded
commit 72fb1a6d6c

View file

@ -523,9 +523,7 @@ uint64_t GetTreeBytes(const std::string& path) {
PLOG(WARNING) << "Failed to open " << path;
return -1;
} else {
uint64_t res = calculate_dir_size(dirfd);
close(dirfd);
return res;
return calculate_dir_size(dirfd);
}
}