mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-16 08:43:17 +00:00
Fix compile of TFTP using GCC
This commit is contained in:
parent
c8808f69b2
commit
abcf42b655
@ -78,17 +78,17 @@ tftp_write(void* handle, struct pbuf* p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* For TFTP client only */
|
/* For TFTP client only */
|
||||||
static int
|
static void
|
||||||
tftp_error(void* handle, int err, const char* msg, int size)
|
tftp_error(void* handle, int err, const char* msg, int size)
|
||||||
{
|
{
|
||||||
char message[100];
|
char message[100];
|
||||||
|
|
||||||
|
LWIP_UNUSED_ARG(handle);
|
||||||
|
|
||||||
memset(message, 0, sizeof(message));
|
memset(message, 0, sizeof(message));
|
||||||
MEMCPY(message, msg, LWIP_MIN(sizeof(message)-1, size));
|
MEMCPY(message, msg, LWIP_MIN(sizeof(message)-1, (size_t)size));
|
||||||
|
|
||||||
printf("TFTP error: %d (%s)", err, message);
|
printf("TFTP error: %d (%s)", err, message);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct tftp_context tftp = {
|
static const struct tftp_context tftp = {
|
||||||
|
@ -47,7 +47,8 @@
|
|||||||
* This is simple TFTP client/server for the lwIP raw API.
|
* This is simple TFTP client/server for the lwIP raw API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lwip/apps/tftp_common.h"
|
#include "lwip/apps/tftp_client.h"
|
||||||
|
#include "lwip/apps/tftp_server.h"
|
||||||
|
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
|
|
||||||
@ -389,7 +390,7 @@ recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16
|
|||||||
case PP_HTONS(TFTP_ERROR):
|
case PP_HTONS(TFTP_ERROR):
|
||||||
if (tftp_state.handle != NULL) {
|
if (tftp_state.handle != NULL) {
|
||||||
pbuf_remove_header(p, TFTP_HEADER_LENGTH);
|
pbuf_remove_header(p, TFTP_HEADER_LENGTH);
|
||||||
tftp_state.ctx->error(tftp_state.handle, sbuf[1], p->payload, p->len);
|
tftp_state.ctx->error(tftp_state.handle, sbuf[1], (const char*)p->payload, p->len);
|
||||||
close_handle();
|
close_handle();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user