Fix writing files from web workflow

Pico W changes assumed that f_write could handle a NULL fourth
argument. It can't.
This commit is contained in:
Scott Shawcroft 2022-11-30 14:22:46 -08:00
parent 2f5ec1cab0
commit 65e913ecd6
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA

View File

@ -907,8 +907,13 @@ static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *req
error = true; error = true;
break; break;
} }
f_write(&active_file, bytes, len, NULL);
total_read += len; total_read += len;
UINT actual;
f_write(&active_file, bytes, len, &actual);
if (actual < (UINT)len) {
error = true;
break;
}
} }
f_close(&active_file); f_close(&active_file);
@ -917,7 +922,10 @@ static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *req
#endif #endif
override_fattime(0); override_fattime(0);
if (new_file) { if (error) {
_discard_incoming(socket, request->content_length - total_read);
_reply_server_error(socket, request);
} else if (new_file) {
_reply_created(socket, request); _reply_created(socket, request);
} else { } else {
_reply_no_content(socket, request); _reply_no_content(socket, request);