>From [EMAIL PROTECTED] Tue Nov 7 05:46:56 2006
Received: from vera.drijf.net (ip234-142-210-87.adsl2.versatel.nl
[87.210.142.234])
by ook.oat.com (8.13.8/8.13.8) with ESMTP id kA7AkuNC015972
for <[EMAIL PROTECTED]>; Tue, 7 Nov 2006 05:46:56 -0500 (EST)
Received: from lou.intra.drijf.net ([EMAIL PROTECTED] [10.0.1.14])
by vera.drijf.net (8.13.8/8.13.8) with ESMTP id kA7ANk2n029198
(version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO);
Tue, 7 Nov 2006 11:23:47 +0100 (CET)
Date: Tue, 7 Nov 2006 11:23:46 +0100 (CET)
To: Geoff Steckel <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED], [email protected]
Subject: Re: Bug in dd?
On Tue, 7 Nov 2006, Otto Moerbeek <[EMAIL PROTECTED]> wrote:
On Tue, 7 Nov 2006, Geoff Steckel wrote:
>> > > > Index: position.c
>> > > > ===================================================================
>> > > > RCS file: /cvs/src/bin/dd/position.c,v
>> > > > retrieving revision 1.7
>> > > > diff -u -p -r1.7 position.c
>> > > > --- position.c 11 Jun 2003 23:42:12 -0000 1.7
>> > > > +++ position.c 6 Nov 2006 12:07:54 -0000
>> > > > @@ -71,7 +71,7 @@ pos_in(void)
>> > > > int warned;
>> > > >
>> > > > /* If not a pipe or tape device, try to seek on it. */
>> > > > - if (!(in.flags & (ISPIPE|ISTAPE))) {
>> > > > + if (!(in.flags & (ISPIPE|ISTAPE|ISCHR))) {
>> > > > if (lseek(in.fd, in.offset * in.dbsz, SEEK_CUR) == -1)
>> > > > err(1, "%s", in.name);
>> > > > return;
>>
>>
>> I may be reading this totally wrong, but won't this
>> change prevent using seek on a character disk device?
>> That would be a -major- loss of functionality as
>> dd has traditionally been used to read areas past
>> bad spots on disks. If I'm wrong, apologies to everyone.
>> geoff steckel
>
>Hmmm, I think you are right. Maybe better test for isatty()?
>
> -Otto
>
>Index: position.c
>===================================================================
>RCS file: /cvs/src/bin/dd/position.c,v
>retrieving revision 1.8
>diff -u -p -r1.8 position.c
>--- position.c 7 Nov 2006 07:10:24 -0000 1.8
>+++ position.c 7 Nov 2006 10:23:17 -0000
>@@ -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;
>
Looks better to me! Are there any other character devices which
should be tested for while this section of code is under repair?
geoff