Turns out libpci is an awful library that on any error calls exit() and has no way of indicating an error otherwise...