summaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/eth-raw-os.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-04-12 12:50:57 -0600
committerTom Rini <trini@konsulko.com>2024-04-12 12:50:57 -0600
commitef8ef5f77c9a998f76a48277a883af1645b54117 (patch)
tree52fdcdbbf87dfa777fa87e8ac9e27577003f5d0a /arch/sandbox/cpu/eth-raw-os.c
parentd5e6401011a269328d3ea69468532b4125fd2bb9 (diff)
parent4341fb73326907faecfc9e3b711bbfcd3937b525 (diff)
Merge branch '2024-04-12-assorted-updates'
- Assorted sandbox fixes, cleanup some of the partition table code and a few other fixes
Diffstat (limited to 'arch/sandbox/cpu/eth-raw-os.c')
-rw-r--r--arch/sandbox/cpu/eth-raw-os.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 92c35aed95d..39ea3b3f012 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -105,7 +105,12 @@ static int _raw_packet_start(struct eth_sandbox_raw_priv *priv,
/* 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;
@@ -172,7 +177,12 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv)
/* 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,