Skip to content

Commit

Permalink
vhost-user: minor simplification
Browse files Browse the repository at this point in the history
Shorten the code and make it more clear by using the specialized
function g_str_has_prefix().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
elmarco authored and mstsirkin committed Jul 28, 2016
1 parent 01edc23 commit d9d2611
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/vhost-user.c
Expand Up @@ -316,7 +316,6 @@ static int net_vhost_check_net(void *opaque, QemuOpts *opts, Error **errp)
{
const char *name = opaque;
const char *driver, *netdev;
const char virtio_name[] = "virtio-net-";

driver = qemu_opt_get(opts, "driver");
netdev = qemu_opt_get(opts, "netdev");
Expand All @@ -326,7 +325,7 @@ static int net_vhost_check_net(void *opaque, QemuOpts *opts, Error **errp)
}

if (strcmp(netdev, name) == 0 &&
strncmp(driver, virtio_name, strlen(virtio_name)) != 0) {
!g_str_has_prefix(driver, "virtio-net-")) {
error_setg(errp, "vhost-user requires frontend driver virtio-net-*");
return -1;
}
Expand Down

0 comments on commit d9d2611

Please sign in to comment.