summaryrefslogtreecommitdiff
path: root/bin/dd
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-11-07 18:47:47 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-11-07 18:47:47 +0000
commitc43ed259113b93b9a5a70101bbd0b332d6ac867a (patch)
tree14080ad7c331b768b95108e3a16f7d7ab61875fe /bin/dd
parent5a7d4ef645f0280a25fd3ae70ca0f714125ecfbb (diff)
It is better to use isatty() to see if a dev is seekable, because
skipping blocks on a raw disk device with bad sectors should be possible. Noted by Geoff Steckel; ok tom@ deraadt@
Diffstat (limited to 'bin/dd')
-rw-r--r--bin/dd/position.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/dd/position.c b/bin/dd/position.c
index 6c6b98d80ff..d0ea5598176 100644
--- a/bin/dd/position.c
+++ b/bin/dd/position.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: position.c,v 1.8 2006/11/07 07:10:24 otto Exp $ */
+/* $OpenBSD: position.c,v 1.9 2006/11/07 18:47:46 otto Exp $ */
/* $NetBSD: position.c,v 1.4 1995/03/21 09:04:12 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)position.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: position.c,v 1.8 2006/11/07 07:10:24 otto Exp $";
+static char rcsid[] = "$OpenBSD: position.c,v 1.9 2006/11/07 18:47:46 otto Exp $";
#endif
#endif /* not lint */
@@ -70,8 +70,8 @@ pos_in(void)
off_t cnt;
int warned;
- /* If not a pipe, tape or char device, try to seek on it. */
- if (!(in.flags & (ISPIPE|ISTAPE|ISCHR))) {
+ /* If not a pipe, tape or tty device, try to seek on it. */
+ if (!(in.flags & (ISPIPE|ISTAPE)) && !isatty(in.fd)) {
if (lseek(in.fd, in.offset * in.dbsz, SEEK_CUR) == -1)
err(1, "%s", in.name);
return;