diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2019-11-13 06:33:30 -0500 |
---|---|---|
committer | Thanos <tmakatos@gmail.com> | 2019-11-20 09:20:40 +0000 |
commit | cb853c117d164566ce541397a12b083090389e01 (patch) | |
tree | 5caa43c5b35c827b046632fd757bcdb02f1e512f /samples/gpio-pci-idio-16.c | |
parent | 2e354836b5a468553a315b4928bf2c120fda3d44 (diff) | |
download | libvfio-user-cb853c117d164566ce541397a12b083090389e01.zip libvfio-user-cb853c117d164566ce541397a12b083090389e01.tar.gz libvfio-user-cb853c117d164566ce541397a12b083090389e01.tar.bz2 |
print error if device emulation fails in GPIO sample
closes #15
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/gpio-pci-idio-16.c')
-rw-r--r-- | samples/gpio-pci-idio-16.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index beb1bd1..cf44ab9 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -51,6 +51,8 @@ bar2_access(void *pvt, char * const buf, size_t count, loff_t offset, int main(int argc, char **argv) { + int err; + lm_dev_info_t dev_info = { .pci_info = { .id = {.vid = 0x494F, .did = 0x0DC8 }, @@ -64,7 +66,11 @@ int main(int argc, char **argv) .uuid = argv[1], }; - return lm_ctx_run(&dev_info); + err = lm_ctx_run(&dev_info); + if (err != 0) { + fprintf(stderr, "failed to realize device emulation: %m\n"); + } + return err; } /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ |