From 72fb1a6d6c02cc01868a2b2e74342d0b8ae683e6 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 29 May 2018 19:05:16 -0700 Subject: [PATCH] Fix double close in GetTreeBytes. calculate_dir_size closes the fd that it receives. Bug: http://b/80446935 Test: treehugger Change-Id: I56a428cd7eb78e56c55434628c1c7b2b87637c81 --- Utils.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index b6c7bf8..102c09a 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -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); } }