summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2019-11-25 18:25:46 +0000
committerFlorin Coras <florin.coras@gmail.com>2019-11-25 20:30:37 +0000
commit0d3d4824a46205e776ff32c82be4cb514f459a5f (patch)
tree1490a7d9f97867670b03321e23b8d0d14f141eb0 /src/vnet/devices
parent599db9e9d0c61ac39b16cc572f975cdc70c07783 (diff)
tap: fix coverity warning 205875
check the return result from fcntl, and if error, behave the same way the expansion of _IOCTL macro does. Type: fix Change-Id: I6d537d1bdedae64470612aef64b46e07387fe84b Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/tap/tap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 5f6d720c645..288099e2685 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -223,7 +223,12 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
else
host_if_name = (char *) args->host_if_name;
- fcntl (tfd, F_SETFL, O_NONBLOCK);
+ if (fcntl (tfd, F_SETFL, O_NONBLOCK) < 0)
+ {
+ err = clib_error_return_unix (0, "fcntl(tfd, F_SETFL, O_NONBLOCK)");
+ tap_log_err (vif, "set nonblocking: %U", format_clib_error, err);
+ goto error;
+ }
tap_log_dbg (vif, "TUNSETVNETHDRSZ: fd %d vnet_hdr_sz %u", tfd, hdrsz);
_IOCTL (tfd, TUNSETVNETHDRSZ, &hdrsz);