From: Richard W.M. Jones Date: Mon, 22 Nov 2010 13:09:26 +0000 (+0000) Subject: cat: Continue after encountering an error. X-Git-Tag: 1.7.12~8 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=730d4db45ec95d9c9592d7721ff1c5a3db036816 cat: Continue after encountering an error. --- 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); }