]> xenbits.xensource.com Git - libvirt.git/commit
virerror: Make virReportEnumRangeError() check for type mismatch
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 18 Sep 2023 14:15:33 +0000 (16:15 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 20 Sep 2023 15:18:48 +0000 (17:18 +0200)
commit19484ccac5cb1586f9d10d3e6eb9b93ee82885c6
tree99e0b4f7e0008d6d783d3a701c6ea689f0913e04
parent83cb91ae3c94b00f2d650eb639b9dd43adaa7fec
virerror: Make virReportEnumRangeError() check for type mismatch

As can be seen from previous commits, it's fairly easy to pass a
different type to virReportEnumRangeError() than the actual
variable is of. So far, we have a sizeof() hack to check if some
nonsensical types are not passed, e.g. it catches cases where a
function name is passed instead of an enum. Extend the hack to
check whether proper enum was passed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virerror.h