From: Joel Rosdahl Date: Thu, 9 Jul 2020 18:57:00 +0000 (+0200) Subject: Remove more short read optimization from #551 X-Git-Tag: v4.0~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cff3bf417420ea88fe53e7267ae2a356898ae326;p=thirdparty%2Fccache.git Remove more short read optimization from #551 In addition to the removal done in 4b71108612f7. --- diff --git a/src/legacy_util.cpp b/src/legacy_util.cpp index 0f08c5bd3..a8c6b177c 100644 --- a/src/legacy_util.cpp +++ b/src/legacy_util.cpp @@ -93,7 +93,7 @@ write_fd(int fd, const void* buf, size_t size) // Copy all data from fd_in to fd_out. bool -copy_fd(int fd_in, int fd_out, bool fd_in_is_file) +copy_fd(int fd_in, int fd_out) { ssize_t n; char buf[READ_BUFFER_SIZE]; @@ -101,10 +101,6 @@ copy_fd(int fd_in, int fd_out, bool fd_in_is_file) if (!write_fd(fd_out, buf, n)) { return false; } - - if (fd_in_is_file && static_cast(n) < sizeof(buf)) { - break; - } } return true; @@ -230,7 +226,7 @@ copy_file(const char* src, const char* dest, bool via_tmp_file) } } - if (copy_fd(*src_fd, *dest_fd, true)) { + if (copy_fd(*src_fd, *dest_fd)) { result = true; } diff --git a/src/legacy_util.hpp b/src/legacy_util.hpp index 734a7733c..9cf6aa80b 100644 --- a/src/legacy_util.hpp +++ b/src/legacy_util.hpp @@ -25,7 +25,7 @@ void fatal(const char* format, ...) ATTR_FORMAT(printf, 1, 2) ATTR_NORETURN; bool write_fd(int fd, const void* buf, size_t size); -bool copy_fd(int fd_in, int fd_out, bool fd_in_is_file = false); +bool copy_fd(int fd_in, int fd_out); bool clone_file(const char* src, const char* dest, bool via_tmp_file); bool copy_file(const char* src, const char* dest, bool via_tmp_file); bool move_file(const char* src, const char* dest);