fix ssize_t bytes_written; if (receive_file != -1) { bytes_written = write(receive_file, buf, length); if (bytes_written != length) { // handle the error, e.g., print an error message or break the loop error("write() failed:

fix  ssize_t bytes_written;  if (receive_file != -1) {     bytes_written = write(receive_file, buf, length);     if (bytes_written != length) {         // handle the error, e.g., print an error message or brea
This commit is contained in:
ck 2023-06-18 17:56:17 +02:00 committed by GitHub
parent 041c190799
commit 32b5f63376
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -728,9 +728,18 @@ int main(int argc, char *argv[])
if (length == 0)
continue;
read += length;
ssize_t bytes_written;
if (receive_file != -1) {
bytes_written = write(receive_file, buf, length);
if (bytes_written != length) {
// handle the error, e.g., print an error message or break the loop
error("write() failed: %s", strerror(errno));
break;
}
}
if (receive_file != -1)
write(receive_file, buf, length);
if (dump) {
for (i = 0; i < length; ++i)
print_byte(buf[i], &ts);