Compare content of opened files using file descriptors A_FD and B_FD. Return true if files are equal. */
| 137 | /* Compare content of opened files using file descriptors A_FD and B_FD. Return |
| 138 | true if files are equal. */ |
| 139 | static bool |
| 140 | have_same_content (int a_fd, int b_fd) |
| 141 | { |
| 142 | enum { CMP_BLOCK_SIZE = 4096 }; |
| 143 | static char a_buff[CMP_BLOCK_SIZE]; |
| 144 | static char b_buff[CMP_BLOCK_SIZE]; |
| 145 | |
| 146 | idx_t size; |
| 147 | while (0 < (size = full_read (a_fd, a_buff, sizeof a_buff))) { |
| 148 | if (size != full_read (b_fd, b_buff, sizeof b_buff)) |
| 149 | return false; |
| 150 | |
| 151 | if (!memeq (a_buff, b_buff, size)) |
| 152 | return false; |
| 153 | } |
| 154 | |
| 155 | return size == 0; |
| 156 | } |
| 157 | |
| 158 | /* Return true for mode with non-permission bits. */ |
| 159 | static bool |