Fix looping bug, use fullRead

This commit is contained in:
Glenn L McGrath 2000-09-13 23:08:07 +00:00
parent b4c3c59a45
commit 56a328810b
2 changed files with 4 additions and 4 deletions

View File

@ -140,9 +140,9 @@ extern int dd_main(int argc, char **argv)
while ((readSize = totalSize - inTotal) > 0) {
if (readSize > BUFSIZ)
readSize=BUFSIZ;
inCc = read(inFd, buf, readSize);
inCc = fullRead(inFd, buf, readSize);
inTotal += inCc;
if ((outCc = fullWrite(outFd, buf, inCc)) < 0)
if ((outCc = fullWrite(outFd, buf, inCc)) < 1)
break;
outTotal += outCc;
}

4
dd.c
View File

@ -140,9 +140,9 @@ extern int dd_main(int argc, char **argv)
while ((readSize = totalSize - inTotal) > 0) {
if (readSize > BUFSIZ)
readSize=BUFSIZ;
inCc = read(inFd, buf, readSize);
inCc = fullRead(inFd, buf, readSize);
inTotal += inCc;
if ((outCc = fullWrite(outFd, buf, inCc)) < 0)
if ((outCc = fullWrite(outFd, buf, inCc)) < 1)
break;
outTotal += outCc;
}