Previously, running `dd ibs=1 count=1` read 512 bytes rather than 1.
---
 dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dd.c b/dd.c
index 6061048..4081eca 100644
--- a/dd.c
+++ b/dd.c
@@ -174,7 +174,7 @@ main(int argc, char *argv[])
                /* XXX: handle non-seekable files */
        }
        while (!eof && (count == -1 || ifull + ipart < count)) {
-               while (ipos - opos < obs) {
+               while (ipos - opos < obs && ifull + ipart < count) {
                        ret = read(ifd, buf + ipos, ibs);
                        if (ret == 0) {
                                eof = 1;
-- 
2.38.1


Reply via email to