net/virtio-user: fix return value check
authorChenbo Xia <chenbo.xia@intel.com>
Wed, 10 Apr 2019 02:44:05 +0000 (02:44 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:54 +0000 (14:51 +0200)
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 <chenbo.xia@intel.com>
Acked-by: Rami Rosen <ramirose@gmail.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
drivers/net/virtio/virtio_user/vhost_user.c

index 827a48a..4b74bd2 100644 (file)
@@ -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;
 }