On 2026-03-11 11:54, Collin Funk wrote:
Minor style thing, but I thought it looked a bit nicer to write:

   w_partial += nwritten != 0;

Hah! I had the following instead, which I thought was even clearer. Pádraig's change to src/dd.c is fine of course. First to fix and all that.

diff --git a/src/dd.c b/src/dd.c index 07b1c6445..585d02bb6 100644 --- a/src/dd.c +++ b/src/dd.c @@ -2261,15 +2261,13 @@ dd_copy (void) { idx_t nwritten = iwrite (STDOUT_FILENO, obuf, n_bytes_read); w_bytes += nwritten; + w_partial += 0 < nwritten && nwritten < input_blocksize; + w_full += nwritten == input_blocksize; if (nwritten != n_bytes_read) { diagnose (errno, _("error writing %s"), quoteaf (output_file)); return EXIT_FAILURE; } - else if (n_bytes_read == input_blocksize) - w_full++; - else - w_partial++; continue; }




Reply via email to