tftp: Signal that the file system write failed

The current behavior when failing to write out a block of data to the
storage media is to print an error and return, presumably hoping that
once the client retries the "lost" packet there will suddenly be space
in the file system.

Instead communicate the error to the client, as expected.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
This commit is contained in:
Bjorn Andersson
2026-01-14 13:25:05 -08:00
committed by Bjorn Andersson
parent 477f031648
commit dd4eebcf5e

View File

@@ -772,8 +772,8 @@ static int handle_writer(struct tftp_client *client)
if (block % client->wsize == 0) {
ret = write(client->fd, client->rw_buf, client->blk_offset);
if (ret < 0) {
/* XXX: report error */
printf("[TQFTP] failed to write data\n");
printf("[TQFTP] failed to write data: %s\n", strerror(errno));
tftp_send_error(client->sock, TFTP_ERROR_ENOSPACE, "Disk full or write error");
return -1;
}