An in-place update found identical data at an identical location. We either * just seek past it, or (for an in-place sparse update), we give the data to * the sparse processor with the use_seek flag set. */
| 190 | * just seek past it, or (for an in-place sparse update), we give the data to |
| 191 | * the sparse processor with the use_seek flag set. */ |
| 192 | int skip_matched(int fd, OFF_T offset, const char *buf, int len) |
| 193 | { |
| 194 | OFF_T pos; |
| 195 | |
| 196 | if (sparse_files > 0) { |
| 197 | if (write_file(fd, 1, offset, buf, len) != len) |
| 198 | return -1; |
| 199 | return 0; |
| 200 | } |
| 201 | |
| 202 | if (flush_write_file(fd) < 0) |
| 203 | return -1; |
| 204 | |
| 205 | if ((pos = do_lseek(fd, len, SEEK_CUR)) != offset + len) { |
| 206 | rsyserr(FERROR_XFER, errno, "lseek returned %s, not %s", |
| 207 | big_num(pos), big_num(offset)); |
| 208 | return -1; |
| 209 | } |
| 210 | |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | /* This provides functionality somewhat similar to mmap() but using read(). |
| 215 | * It gives sliding window access to a file. mmap() is not used because of |
no test coverage detected