rte_virtio: add missing if() brackets

Some error messages were printed
outside of the error-checking
if() condition.

Fixes: bd273d4 ("rte_vhost: replace strerror() with spdk_strerror_r()")

Change-Id: Icf965ae56ffc2e0970572308b38607ac63cdb1f2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382943
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-10-18 13:30:18 +02:00 committed by Daniel Verkamp
parent 6f95c32590
commit eba48d825c
2 changed files with 4 additions and 2 deletions

View File

@ -239,9 +239,10 @@ virtio_user_notify_queue(struct virtio_dev *vdev, struct virtqueue *vq)
struct virtio_user_dev *dev = virtio_dev_get_user_dev(vdev);
char err_str[64];
if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0) {
spdk_strerror_r(errno, err_str, sizeof(err_str));
SPDK_ERRLOG("failed to kick backend: %s.\n", err_str);
}
}
static void

View File

@ -437,9 +437,10 @@ vhost_user_setup(struct virtio_user_dev *dev)
}
flag = fcntl(fd, F_GETFD);
if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0)
if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0) {
spdk_strerror_r(errno, err_str, sizeof(err_str));
SPDK_ERRLOG("fcntl failed, %s\n", err_str);
}
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;