Simplify fill_chunker() - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 66a94e3ce6d7c193d13d0bad4b1b8f7ecd51f5d2 DIR parent 83276cee93b10e5def83fa4ea7400accb9272566 HTML Author: sin <sin@2f30.org> Date: Fri, 22 Feb 2019 15:34:19 +0000 Simplify fill_chunker() Juse use the utility function we have. Diffstat: M chunker.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) --- DIR diff --git a/chunker.c b/chunker.c @@ -99,16 +99,9 @@ fill_chunker(struct chunker *chunker) uint8_t *bp; ssize_t n; - while (chunker->cap != chunker->wpos) { - bp = &chunker->buf[chunker->wpos]; - n = read(chunker->fd, bp, chunker->cap - chunker->wpos); - if (n < 0) - err(1, "read"); - else if (n == 0) - break; - chunker->wpos += n; - } - + bp = &chunker->buf[chunker->wpos]; + n = xread(chunker->fd, bp, chunker->cap - chunker->wpos); + chunker->wpos += n; return chunker->wpos; }