Project

General

Profile

Feature #15006 ยป copy-file-range.patch

byroot (Jean Boussier), 08/18/2018 03:32 AM

View differences:

io.c
10787 10787
static int
10788 10788
nogvl_copy_file_range(struct copy_stream_struct *stp)
10789 10789
{
10790
    struct stat src_stat, dst_stat;
10791 10790
    ssize_t ss;
10792
    int ret;
10793

  
10794 10791
    off_t copy_length, src_offset, *src_offset_ptr;
10795 10792

  
10796
    ret = fstat(stp->src_fd, &src_stat);
10797
    if (ret == -1) {
10798
        stp->syserr = "fstat";
10799
        stp->error_no = errno;
10800
        return -1;
10801
    }
10802
    if (!S_ISREG(src_stat.st_mode))
10803
        return 0;
10804

  
10805
    ret = fstat(stp->dst_fd, &dst_stat);
10806
    if (ret == -1) {
10807
        stp->syserr = "fstat";
10808
        stp->error_no = errno;
10809
        return -1;
10810
    }
10811

  
10812 10793
    src_offset = stp->src_offset;
10813 10794
    if (src_offset != (off_t)-1) {
10814 10795
	src_offset_ptr = &src_offset;
......
10819 10800

  
10820 10801
    copy_length = stp->copy_length;
10821 10802
    if (copy_length == (off_t)-1) {
10803
	int ret;
10804
	struct stat src_stat;
10805

  
10806
	ret = fstat(stp->src_fd, &src_stat);
10807
	if (ret == -1) {
10808
	    stp->syserr = "fstat";
10809
	    stp->error_no = errno;
10810
	    return -1;
10811
	}
10812

  
10822 10813
	if (src_offset == (off_t)-1) {
10823 10814
	    off_t current_offset;
10824 10815
            errno = 0;