aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-11-23 07:06:35 -0500
committerThanos <tmakatos@gmail.com>2020-11-23 12:56:08 +0000
commitf2f23168dbf5002660fa6b252a55ad79b5746993 (patch)
treee92c4023bcc0a3417ce75c7a09bfaf80187078b2 /samples
parentdf39d1b810bcd576927da6edf75c6958db726abc (diff)
downloadlibvfio-user-f2f23168dbf5002660fa6b252a55ad79b5746993.zip
libvfio-user-f2f23168dbf5002660fa6b252a55ad79b5746993.tar.gz
libvfio-user-f2f23168dbf5002660fa6b252a55ad79b5746993.tar.bz2
don't ignore return value from function
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/null.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/samples/null.c b/samples/null.c
index caec23f..2dd1bdd 100644
--- a/samples/null.c
+++ b/samples/null.c
@@ -92,7 +92,9 @@ int main(int argc, char **argv)
}
printf("press enter to stop device emulation and clean up\n");
- getchar();
+ if (getchar() == EOF) {
+ err(EXIT_FAILURE, NULL);
+ }
ret = pthread_cancel(thread);
if (ret != 0) {
@@ -102,7 +104,9 @@ int main(int argc, char **argv)
lm_ctx_destroy(lm_ctx);
printf("device emulation stopped and cleaned up, press enter to exit\n");
- getchar();
+ if (getchar() == EOF) {
+ err(EXIT_FAILURE, NULL);
+ }
return ret;
}