summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src/filesystem/ops.cc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-10-24 17:45:40 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2016-10-24 17:45:40 +0100
commitcfef9c1ea79749cb3fc40b3ef869a29470c6073c (patch)
treec119b9f704881041a13c1dedd3ae98ece8579cba /libstdc++-v3/src/filesystem/ops.cc
parentb3dec9e57e6960cae54187b7fa416052c8e32e19 (diff)
downloadgcc-cfef9c1ea79749cb3fc40b3ef869a29470c6073c.tar.gz
Do not retry failed close(3) in filesystem::copy
* src/filesystem/ops.cc (close_fd): Remove. (do_copy_file): Just use close(3) instead of close_fd, to prevent retrying on error. From-SVN: r241485
Diffstat (limited to 'libstdc++-v3/src/filesystem/ops.cc')
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc15
1 files changed, 2 insertions, 13 deletions
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index 6f76053d571..f8ba74ecbb3 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -308,17 +308,6 @@ namespace
return fs::file_time_type{seconds{s} + ns};
}
- // Returns true if the file descriptor was successfully closed,
- // otherwise returns false and the reason will be in errno.
- inline bool
- close_fd(int fd)
- {
- while (::close(fd))
- if (errno != EINTR)
- return false;
- return true;
- }
-
bool
do_copy_file(const fs::path& from, const fs::path& to,
fs::copy_options option,
@@ -405,8 +394,8 @@ namespace
}
struct CloseFD {
- ~CloseFD() { if (fd != -1) close_fd(fd); }
- bool close() { return close_fd(std::exchange(fd, -1)); }
+ ~CloseFD() { if (fd != -1) ::close(fd); }
+ bool close() { return ::close(std::exchange(fd, -1)) == 0; }
int fd;
};