Browse Source

fixed bug #42117 lwip_fcntl does not set errno

STABLE-2_1_x
Simon Goldschmidt 12 years ago
parent
commit
5c37c63cef
  1. 3
      CHANGELOG
  2. 7
      src/api/sockets.c

3
CHANGELOG

@ -117,6 +117,9 @@ HISTORY
++ Bugfixes:
2014-09-02: Simon Goldschmidt
* sockets.c: fixed bug #42117 lwip_fcntl does not set errno
2014-09-02: Simon Goldschmidt
* tcp.c: fixed bug #42299 tcp_abort() leaves freed pcb on tcp_bound_pcbs list

7
src/api/sockets.c

@ -2622,23 +2622,28 @@ lwip_fcntl(int s, int cmd, int val)
struct lwip_sock *sock = get_socket(s);
int ret = -1;
if (!sock || !sock->conn) {
if (!sock) {
return -1;
}
switch (cmd) {
case F_GETFL:
ret = netconn_is_nonblocking(sock->conn) ? O_NONBLOCK : 0;
sock_set_errno(sock, 0);
break;
case F_SETFL:
if ((val & ~O_NONBLOCK) == 0) {
/* only O_NONBLOCK, all other bits are zero */
netconn_set_nonblocking(sock->conn, val & O_NONBLOCK);
ret = 0;
sock_set_errno(sock, 0);
} else {
sock_set_errno(sock, ENOSYS); /* not yet implemented */
}
break;
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
sock_set_errno(sock, ENOSYS); /* not yet implemented */
break;
}
return ret;

Loading…
Cancel
Save