summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-24 16:45:40 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-24 16:45:40 +0000
commit89131006ad9bab87c5951ae5c143daacbdb30c35 (patch)
treec119b9f704881041a13c1dedd3ae98ece8579cba
parentb45383925be815683b9efb8f7582c9dd1bbda624 (diff)
downloadgcc-89131006ad9bab87c5951ae5c143daacbdb30c35.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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241485 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc15
2 files changed, 6 insertions, 13 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 112e9415c7f..577c88f3ec8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2016-10-24 Jonathan Wakely <jwakely@redhat.com>
+ * src/filesystem/ops.cc (close_fd): Remove.
+ (do_copy_file): Just use close(3) instead of close_fd, to prevent
+ retrying on error.
+
* src/filesystem/ops.cc (do_copy_file): Return an error if either
source or destination is not a regular file.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
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;
};