lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Bad assert in lwip_sendto


From: steinarl
Subject: [lwip-users] Bad assert in lwip_sendto
Date: Thu, 24 Apr 2008 14:01:12 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.1.5)

I'm a bit uncertain here, so please correct me if I'm wrong. This is
from the CVS head, in sockets.c:

LWIP_ERROR("lwip_sendto: invalid address",
  (((to == NULL) && (tolen == 0)) ||
  ((tolen == sizeof(struct sockaddr_in)) &&
  ((((struct sockaddr_in *)to)->sin_family) == AF_INET))),
  sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1;);

The first condition, ((to == NULL) && (tolen == 0)), is as far as I
can tell not desired, so shouldn't it be ((to != NULL) && (tolen !=
0)) instead?

The explanation for the LWIP_ERROR macro also seems to state the opposite of what the code does, no?

/** print "m" message only if "e" is true, and execute "h" expression */
#ifndef LWIP_ERROR
#define LWIP_ERROR(m,e,h) do { if (!(e)) { LWIP_PLATFORM_ASSERT(m); h;}} while(0)
#endif /* LWIP_ERROR */

Steinar





reply via email to

[Prev in Thread] Current Thread [Next in Thread]