summaryrefslogtreecommitdiff
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
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.
-rw-r--r--bin/dd/args.c6
-rw-r--r--bin/dd/dd.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c
index 95e4979601c..ed3522cd647 100644
--- a/bin/dd/args.c
+++ b/bin/dd/args.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: args.c,v 1.9 2001/08/07 14:39:27 hugh Exp $ */
+/* $OpenBSD: args.c,v 1.10 2001/10/04 20:32:27 millert Exp $ */
/* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: args.c,v 1.9 2001/08/07 14:39:27 hugh Exp $";
+static char rcsid[] = "$OpenBSD: args.c,v 1.10 2001/10/04 20:32:27 millert Exp $";
#endif
#endif /* not lint */
@@ -212,8 +212,6 @@ f_count(arg)
{
cpy_cnt = get_bsz(arg);
- if (!cpy_cnt)
- terminate(0);
}
static void
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);