diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-02-14 07:05:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-02-14 07:05:23 +0000 |
commit | 864ab5f6b1dea0318ac16c95ee2a7b998ffcddc1 (patch) | |
tree | a80f6f39032c4cda85513a942c2771a0c2343468 /bin/dd/position.c | |
parent | c55cc0d192f7a44076e9b69df1c82a11b9275150 (diff) |
Deal with 64-bit offsets and report bytes copied as a 64-bit quantity.
Closes OpenBSD PR system/107.
Diffstat (limited to 'bin/dd/position.c')
-rw-r--r-- | bin/dd/position.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/dd/position.c b/bin/dd/position.c index ca2612d2960..a02a485bb55 100644 --- a/bin/dd/position.c +++ b/bin/dd/position.c @@ -1,4 +1,4 @@ -/* $OpenBSD: position.c,v 1.2 1996/06/23 14:19:49 deraadt Exp $ */ +/* $OpenBSD: position.c,v 1.3 1997/02/14 07:05:22 millert Exp $ */ /* $NetBSD: position.c,v 1.4 1995/03/21 09:04:12 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)position.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: position.c,v 1.2 1996/06/23 14:19:49 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: position.c,v 1.3 1997/02/14 07:05:22 millert Exp $"; #endif #endif /* not lint */ @@ -68,11 +68,14 @@ static char rcsid[] = "$OpenBSD: position.c,v 1.2 1996/06/23 14:19:49 deraadt Ex void pos_in() { - int bcnt, cnt, nr, warned; + size_t bcnt; + ssize_t nr; + off_t cnt; + int warned; /* If not a character, pipe or tape device, try to seek on it. */ if (!(in.flags & (ISCHR|ISPIPE|ISTAPE))) { - if (lseek(in.fd, (off_t)(in.offset * in.dbsz), SEEK_CUR) == -1) + if (lseek(in.fd, in.offset * in.dbsz, SEEK_CUR) == -1) err(1, "%s", in.name); return; } @@ -123,7 +126,8 @@ void pos_out() { struct mtop t_op; - int cnt, n; + off_t cnt; + ssize_t n; /* * If not a tape, try seeking on the file. Seeking on a pipe is @@ -131,8 +135,7 @@ pos_out() * have specified the seek operand. */ if (!(out.flags & ISTAPE)) { - if (lseek(out.fd, - (off_t)out.offset * out.dbsz, SEEK_SET) == -1) + if (lseek(out.fd, out.offset * out.dbsz, SEEK_SET) == -1) err(1, "%s", out.name); return; } |