From cb853c117d164566ce541397a12b083090389e01 Mon Sep 17 00:00:00 2001 From: Thanos Makatos Date: Wed, 13 Nov 2019 06:33:30 -0500 Subject: print error if device emulation fails in GPIO sample closes #15 Signed-off-by: Thanos Makatos --- samples/gpio-pci-idio-16.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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: */ -- cgit v1.1