Commit Graph

4 Commits

Author SHA1 Message Date
Michael Forney fb16e7c6ad dd: Consider block count in inner read loop
When ibs is smaller than obs, checking the block count in the outer
loop is not sufficient; we need to break out of the inner read loop
once we've read the specified number of blocks.

Thanks to phoebos for reporting this issue.
2023-04-12 20:47:34 -07:00
Michael Forney 00995639fe dd: Fix backwards comparison when handling short writes
ipos is always ahead of opos, so the left side of this condition
was never true. This only mattered when we get short writes, since
on EOF we always have less than a full output block, so it takes
only one normal write.
2023-04-12 20:09:51 -07:00
Michael Forney 4b76652eff dd: Always move excess to beginning of buffer after read/write loops
Otherwise, while we may have enough room for at least one input
block, we may not have enough room for an output block.
2021-05-21 12:16:41 -07:00
Michael Forney 6ff6bb57ce Add implementation of dd(1) 2020-05-12 19:58:21 -07:00