Introduction
Introduction Statistics Contact Development Disclaimer Help
dd: Always move excess to beginning of buffer after read/write loops - sbase - …
git clone git://git.suckless.org/sbase
Log
Files
Refs
README
LICENSE
---
commit 4b76652eff2b6f7d23c800dbc48c509792c726b3
parent 7ef4038fb5b93e63f4223ab9f222526130a1e14f
Author: Michael Forney <[email protected]>
Date: Wed, 28 Apr 2021 01:41:26 -0700
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.
Diffstat:
M dd.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/dd.c b/dd.c
@@ -222,11 +222,10 @@ main(int argc, char *argv[])
ofull++;
opos += ret;
} while ((eof && ipos < opos) || (!eof && ipos - opos >= obs));
- if (len - ipos < ibs) {
+ if (opos < ipos)
memmove(buf, buf + opos, ipos - opos);
- ipos -= opos;
- opos = 0;
- }
+ ipos -= opos;
+ opos = 0;
}
summary();
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.