summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 00bd08c29..6687d235e 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -603,6 +603,9 @@ class LoadTask {
}
void set_fd(int fd, bool assume_ownership) {
+ if (fd_ != -1 && close_fd_) {
+ close(fd_);
+ }
fd_ = fd;
close_fd_ = assume_ownership;
}