From dcadb4f390cbb39306473ec65ce3b067d52a79f1 Mon Sep 17 00:00:00 2001 From: grehan Date: Mon, 1 Jul 2013 23:53:22 +0000 Subject: Fix up option parsing to allow a colon in the config section. Clean up some other unnecessary code. Submitted by: Dinakar Medavaram dinnu sun at gmail Reviewed by: neel --- usr.sbin/bhyve/pci_emul.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'usr.sbin/bhyve') diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index a30dde5..76e536c 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -140,20 +140,15 @@ pci_parse_slot(char *opt, int legacy) error = -1; str = cpy = strdup(opt); - config = NULL; - - if (strchr(str, ':') != NULL) { - slot = strsep(&str, ":"); - func = strsep(&str, ","); - } else { - slot = strsep(&str, ","); - func = NULL; - } - + slot = strsep(&str, ","); + func = NULL; + if (strchr(slot, ':') != NULL) { + func = cpy; + (void) strsep(&func, ":"); + } + emul = strsep(&str, ","); - if (str != NULL) { - config = strsep(&str, ","); - } + config = str; if (emul == NULL) { pci_parse_slot_usage(opt); -- cgit v1.1