On 23/10/15 20:32, Anna Schumaker wrote: > + len = stat.st_size; > + > + fd_out = open(argv[2], O_CREAT|O_WRONLY|O_TRUNC, 0644); > + if (fd_out == \-1) { > + perror("open (argv[2])"); > + exit(EXIT_FAILURE); > + } > + > + do { > + ret = copy_file_range(fd_in, NULL, fd_out, NULL, len, 0); > + if (ret == \-1) { > + perror("copy_file_range"); > + exit(EXIT_FAILURE); > + } > + > + len \-= ret; > + } while (len > 0); Is this an infinite loop if len decreases before the copy completes? Perhaps this should be: while (len && ret); Otherwise this set looks good. I'm a bit worried about the sparse expansion and default reflinking which might preclude cp(1) from using this call in most cases, but I will test and try to use it. coreutils has heuristics for determining if files are remote, which we might use to restrict to that use case. thanks, Pádraig. -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html