[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dd bug in 4.0
From: |
Tim Wright |
Subject: |
dd bug in 4.0 |
Date: |
Fri, 02 Mar 2001 08:42:32 -0800 |
Hi all,
Use of 'dd conv=noerror,sync' with a reasonably large blocksize (large enough
to not be a clean multiple of the input size), generates an incorrect summary.
The blocks out will report 'XXXXX+0' rather than '+1' indicating a partial
block write.
The erroneous code is here:
if (ibuf == obuf) /* If not C_TWOBUFS. */
{
int nwritten = full_write (output_fd, obuf, nread);
if (nwritten < 0)
{
error (0, errno, "%s", output_file);
quit (1);
}
else if (nread == input_blocksize)
w_full++;
else
w_partial++;
continue;
}
The
else if (nread == input_blocksize)
should read
else if (nwritten == input_blocksize)
because when conv=sync is specified, nread gets reset to input_blocksize. We
want to know if we wrote a partial block, not if we read one.
Regards,
Tim
--
Tim Wright | Aracnet -- Portland's loudest electrons
address@hidden OR | Ring +1 503 906 8997 V.90 (56K) 24hrs
address@hidden | Browse http://www.aracnet.com for info!
"Nobody ever said I was charming, they said "Rimmer, you're a git!"" RD VI
- dd bug in 4.0,
Tim Wright <=