From 730d4db45ec95d9c9592d7721ff1c5a3db036816 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 22 Nov 2010 13:09:26 +0000 Subject: [PATCH] cat: Continue after encountering an error. --- cat/virt-cat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cat/virt-cat.c b/cat/virt-cat.c index 3510a94..2587e56 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); } -- 1.8.3.1