Just setting a reasonable error string using error_setg() is
simpler and makes error messages clearer.
Before:
$ qemu-system-x86_64 -device e1000,mac=x
qemu-system-x86_64: -device e1000,mac=x: Property 'e1000.mac' doesn't take value 'x'
After:
$ qemu-system-x86_64 -device e1000,mac=x
qemu-system-x86_64: -device e1000,mac=x: Property 'e1000.mac' can't take value 'x': invalid mac address
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
hw/core/qdev-properties-system.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index a5a1a6ffee..fc0abcae17 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -336,7 +336,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
return;
inval:
- error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
+ error_setg(errp, "invalid mac address");
g_free(str);
}
--
2.28.0