summaryrefslogtreecommitdiff
path: root/bin/dd/dd.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-10-04 20:32:28 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-10-04 20:32:28 +0000
commitab3e79a9bdb6149377d5ff4cad895b1cf1837c2b (patch)
tree62f1ee443caa152e400ca25326e02348f333cbfe /bin/dd/dd.c
parentae0af87072a52028a89ef7da9919222b248d75b7 (diff)
Move check for count=0 into dd's main. We want to do normal setup
in this case and just don't want to actually copy any data. Fixes a problem noted by aaron@ where the time portion of the summary would be wrong and also gives us sane behavior when seek is non-zero but count is 0.
Diffstat (limited to 'bin/dd/dd.c')
-rw-r--r--bin/dd/dd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index b9daa89f8bf..03176396cd6 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dd.c,v 1.9 2001/08/07 14:39:27 hugh Exp $ */
+/* $OpenBSD: dd.c,v 1.10 2001/10/04 20:32:27 millert Exp $ */
/* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */
/*-
@@ -48,7 +48,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: dd.c,v 1.9 2001/08/07 14:39:27 hugh Exp $";
+static char rcsid[] = "$OpenBSD: dd.c,v 1.10 2001/10/04 20:32:27 millert Exp $";
#endif
#endif /* not lint */
@@ -97,8 +97,10 @@ main(argc, argv)
atexit(summary);
- while (files_cnt--)
- dd_in();
+ if (cpy_cnt > 0) {
+ while (files_cnt--)
+ dd_in();
+ }
dd_close();
exit(0);