[git commit] dd: code shrink

Denys Vlasenko vda.linux at googlemail.com
Tue Aug 20 10:45:05 UTC 2013


commit: http://git.busybox.net/busybox/commit/?id=1b57fe108f082167fd85a5962769a941ba871dd4
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
dd_main                                             1487    1475     -12

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/dd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/coreutils/dd.c b/coreutils/dd.c
index e046ff5..9299f58 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) {


More information about the busybox-cvs mailing list