In open, the socket is correctly checked to be -1 in the error case.
In send and recv, we checked for 0, but that is a valid socket number.
Correct this by checking for -1 as a bad socket everywhere.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
int retval;
struct udphdr *udph = packet + sizeof(struct iphdr);
- if (!priv->sd || !priv->device)
+ if (priv->sd < 0 || !priv->device)
return -EINVAL;
/*
int retval;
int saddr_size;
- if (!priv->sd || !priv->device)
+ if (priv->sd < 0 || !priv->device)
return -EINVAL;
saddr_size = sizeof(struct sockaddr);
retval = recvfrom(priv->sd, packet, 1536, 0,