mirror of
https://codeberg.org/landley/toybox.git
synced 2026-01-26 06:07:55 +00:00
xsendfile_len() to exit with error if underlying write fails
cp currently will exit with success even if the underlying write syscall fails with an error. Fixing this behavior. Signed-off-by: Utsav Munendra <utsavm@meta.com>
This commit is contained in:
parent
494f9c4efc
commit
0f5e2f0ace
@ -867,9 +867,9 @@ long long xsendfile_len(int in, int out, long long bytes)
|
||||
{
|
||||
long long len = sendfile_len(in, out, bytes, 0);
|
||||
|
||||
if (bytes != -1 && bytes != len) {
|
||||
if (len == -1 || (bytes != -1 && bytes != len)) {
|
||||
if (out == 1 && len<0) xexit();
|
||||
error_exit("short %s", (len<0) ? "write" : "read");
|
||||
perror_exit("short %s", (len<0) ? "write" : "read");
|
||||
}
|
||||
|
||||
return len;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user