]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove more short read optimization from #551
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 9 Jul 2020 18:57:00 +0000 (20:57 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 9 Jul 2020 18:57:00 +0000 (20:57 +0200)
In addition to the removal done in 4b71108612f7.

src/legacy_util.cpp
src/legacy_util.hpp

index 0f08c5bd35614e01f005a6074b6cf2fd9ed3e4c6..a8c6b177c4e87e1b2d7f3f71dd13236517616443 100644 (file)
@@ -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<size_t>(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;
   }
 
index 734a7733c4f6d3aff2ad034da921e418756839b5..9cf6aa80b8d23e1aae9e33d236d39c2fa3ae34fb 100644 (file)
@@ -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);