/* Make the socket non-blocking */
flags = fcntl(priv->sd, F_GETFL, 0);
- fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK);
+ ret = fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK);
+ if (ret == -1) {
+ printf("Failed to make socket non-blocking: %d %s\n", errno,
+ strerror(errno));
+ return -errno;
+ }
/* Enable promiscuous mode to receive responses meant for us */
mr.mr_ifindex = device->sll_ifindex;
/* Make the socket non-blocking */
flags = fcntl(priv->sd, F_GETFL, 0);
- fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK);
+ ret = fcntl(priv->sd, F_SETFL, flags | O_NONBLOCK);
+ if (ret == -1) {
+ printf("Failed to make socket non-blocking: %d %s\n", errno,
+ strerror(errno));
+ return -errno;
+ }
/* Include the UDP/IP headers on send and receive */
ret = setsockopt(priv->sd, IPPROTO_IP, IP_HDRINCL, &one,