From: Chenbo Xia Date: Wed, 10 Apr 2019 02:44:05 +0000 (+0000) Subject: net/virtio-user: fix return value check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1e9868885f2ed388e827e8ce27d4b690c9b2fb90;p=dpdk.git net/virtio-user: fix return value check Fix unchecked return value for fcntl. Coverity issue: 277210 Fixes: bd8f50a45d0f ("net/virtio-user: support server mode") Cc: stable@dpdk.org Signed-off-by: Chenbo Xia Acked-by: Rami Rosen Reviewed-by: Jens Freimann Reviewed-by: Tiwei Bie --- diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index 827a48ad67..4b74bd2d80 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -394,7 +394,10 @@ virtio_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un) return -1; flag = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flag | O_NONBLOCK); + if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) { + PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno)); + return -1; + } return 0; }