From 4c31c7a92eef5c8a63aba45dabbf7a4249e51fee Mon Sep 17 00:00:00 2001 From: Philipp Riederer Date: Mon, 30 Jan 2023 09:08:41 +0100 Subject: [PATCH] handle disk full --- ftpd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ftpd.c b/ftpd.c index d6a7168..ba74e11 100644 --- a/ftpd.c +++ b/ftpd.c @@ -552,8 +552,12 @@ static err_t ftpd_datarecv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t len = vfs_write(q->payload, 1, q->len, fsd->vfs_file); tot_len += len; - if (len != q->len) + if (len != q->len) { + vfs_close(fsd->vfs_file); + fsd->vfs_file = NULL; + close_with_message(fsd, pcb, msg553); break; + } } /* Inform TCP that we have taken the data. */