From: Junio C Hamano Date: Fri, 12 Aug 2022 20:26:24 GMT Subject: Re: [PATCH v4 05/11] scalar-diagnose: move functionality to common location Message-ID: In-Reply-To: "Victoria Dye via GitGitGadget" writes: > + res = write_archive(archiver_args.nr, (const char **)argv_copy, NULL, > + the_repository, NULL, 0); > + if (res) { > + error(_("failed to write archive")); > + goto diagnose_cleanup; > + } > + > + fprintf(stderr, "\n" > + "Diagnostics complete.\n" > + "All of the gathered info is captured in '%s'\n", > + zip_path->buf); > + > +diagnose_cleanup: > + if (archiver_fd >= 0) { > + dup2(stdout_fd, STDOUT_FILENO); > + close(stdout_fd); > + close(archiver_fd); > + } Hmph, after reading https://lore.kernel.org/git/32f2cadc-556e-1cd5-a238-c8f1cdaaf470@github.com/ I would have expected to see the above part more like: res = write_archive(...); diagnose_cleanup: if (res) error(...); else fprintf(stderr, "Diag complete"); if (archiver_fd >= 0) { ...