Denys Vlasenko wrote:
> +               off_t offset = 0;
> +               sendfile(fd, f, &offset, f_stat.st_size);
> 
> What will happen if f_stat.st_size > INT_MAX (2 gb) ?

If busybox was compiled with large file support, both off_t and 
f_stat.st_size should be 64-bit, no? And if busybox was compiled without 
large file support, the open() would have failed already with EFBIG.

I noticed the return status of sendfile isn't checked at all, and that is 
bad. Sendfile fails with EINVAL on filesystems without mmap() support 
(for example unionfs), and in that case busybox should fall back to the 
old method. And I think sendfile() is also allowed to return with a value 
less than f_stat.st_size, but I'm not sure if that ever happens in practice.

Eric
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to