mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 09:19:53 +00:00
Fix bug in FIONREAD handling in LINUXMODE
Fix a bug in the socket API's ioctl for FIONREAD. If the socket's lastdata was assigned the function returned without error but did not update the argument pointer. The cast type for argp was also changed to int to conform with the other SO_RCVBUF handling.
This commit is contained in:
parent
fd891081c4
commit
2a8398dfb8
@ -2621,18 +2621,20 @@ lwip_ioctl(int s, long cmd, void *argp)
|
||||
struct pbuf *p;
|
||||
if (sock->lastdata) {
|
||||
p = ((struct netbuf *)sock->lastdata)->p;
|
||||
*((int*)argp) = p->tot_len - sock->lastoffset;
|
||||
} else {
|
||||
struct netbuf *rxbuf;
|
||||
err_t err;
|
||||
if (sock->rcvevent <= 0) {
|
||||
*((u16_t*)argp) = 0;
|
||||
*((int*)argp) = 0;
|
||||
} else {
|
||||
err = netconn_recv(sock->conn, &rxbuf);
|
||||
if (err != ERR_OK) {
|
||||
*((u16_t*)argp) = 0;
|
||||
*((int*)argp) = 0;
|
||||
} else {
|
||||
sock->lastdata = rxbuf;
|
||||
*((u16_t*)argp) = rxbuf->p->tot_len;
|
||||
sock->lastoffset = 0;
|
||||
*((int*)argp) = rxbuf->p->tot_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user