On Mon, 31 Oct 2005, Theodoros V. Kalamatianos wrote:

It seems that it just reads and drops one more record than it should.

I have verified with `wc' that the characters are indeed dropped end not e.g. replaced with a null. I'll see if I can trace this bug, but it may take some time.

Ok, maybe not so much time :-) The following patch should fix this:

# diff -uNr dd.c.orig dd.c
--- dd.c.orig   2005-10-01 08:54:57.000000000 +0300
+++ dd.c        2005-10-31 09:58:00.000000000 +0200
@@ -1167,7 +1167,7 @@
          if (fdesc == STDIN_FILENO)
            advance_input_offset (nread);
        }
-      while (records-- != 0);
+      while (--records != 0);

       return records;
     }

Note that in records-- the variable is decreased _after_ it's used in the comparison, causing one additional loop iteration. By changing that to --records we avoid this.

Regards,

Theodoros Kalamatianos


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to