summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cat/virt-cat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cat/virt-cat.c b/cat/virt-cat.c
index 3510a948..2587e563 100644
--- a/cat/virt-cat.c
+++ b/cat/virt-cat.c
@@ -237,13 +237,15 @@ main (int argc, char *argv[])
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
+ unsigned errors = 0;
+
while (optind < argc) {
if (guestfs_download (g, argv[optind], "/dev/stdout") == -1)
- exit (EXIT_FAILURE);
+ errors++;
optind++;
}
guestfs_close (g);
- exit (EXIT_SUCCESS);
+ exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}