From: Denys Vlasenko Date: Tue, 20 Aug 2013 10:45:05 +0000 (+0200) Subject: dd: code shrink X-Git-Tag: 1_22_0~98 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1b57fe108f082167fd85a5962769a941ba871dd4;p=oweals%2Fbusybox.git dd: code shrink function old new delta dd_main 1487 1475 -12 Signed-off-by: Denys Vlasenko --- diff --git a/coreutils/dd.c b/coreutils/dd.c index e046ff5cc..9299f58bc 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -363,13 +363,13 @@ int dd_main(int argc UNUSED_PARAM, char **argv) } if (skip) { if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) { - while (skip-- > 0) { + do { ssize_t n = safe_read(ifd, ibuf, ibs); if (n < 0) goto die_infile; if (n == 0) break; - } + } while (--skip != 0); } } if (seek) {