|
From: | Dirk Ziegelmeier |
Subject: | Re: [lwip-devel] tftp_server.c read problem |
Date: | Thu, 9 Mar 2017 21:09:05 +0100 |
I wanted to try tftp transfer on Windows. Hence I copied
the tftp-serving code from simhost.c. But ran into
problems on reading and storing files that was not a
multiple of 512 bytes (they seldom are). I got a truncated
file.
Seems to be related to this:
tftp_read(void* handle, void* buf, int bytes)
{
if (fread(buf, 1, bytes, (FILE*)handle) != (size_t)bytes) {
return -1;
}
Shouldn't it be:
int ret = (int)fread (buf, 1, bytes, (FILE*)handle);
if (ret <= 0)
return (-1);
return (ret);
Thus allowing tftp_server.c to not close the session on
a short fread()?
PS. I used curl as the tftp-client.
--
--gv
_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel
[Prev in Thread] | Current Thread | [Next in Thread] |