From 1b57fe108f082167fd85a5962769a941ba871dd4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 20 Aug 2013 12:45:05 +0200 Subject: [PATCH] dd: code shrink function old new delta dd_main 1487 1475 -12 Signed-off-by: Denys Vlasenko --- coreutils/dd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {