* Map a externally used socket index to the internal socket representation. * * @param fd externally used socket index * @return struct lwip_sock for the socket or NULL if not found */
| 495 | * @return struct lwip_sock for the socket or NULL if not found |
| 496 | */ |
| 497 | static struct lwip_sock * |
| 498 | get_socket(int fd) |
| 499 | { |
| 500 | struct lwip_sock *sock = tryget_socket(fd); |
| 501 | if (!sock) { |
| 502 | if ((fd < LWIP_SOCKET_OFFSET) || (fd >= (LWIP_SOCKET_OFFSET + NUM_SOCKETS))) { |
| 503 | LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", fd)); |
| 504 | } |
| 505 | set_errno(EBADF); |
| 506 | return NULL; |
| 507 | } |
| 508 | return sock; |
| 509 | } |
| 510 | |
| 511 | /** |
| 512 | * Allocate a new socket for a given netconn. |
no test coverage detected