xfs
[Top] [All Lists]

Re: [PATCH v3 04/11] xfsprogs: Add ifdef dirent checks where it was miss

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH v3 04/11] xfsprogs: Add ifdef dirent checks where it was missing
From: Jan Tulak <jtulak@xxxxxxxxxx>
Date: Tue, 4 Aug 2015 05:21:22 -0400 (EDT)
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150804084625.GB12844@xxxxxxxxxxxxx>
References: <1438612789-17486-1-git-send-email-jtulak@xxxxxxxxxx> <1438612789-17486-5-git-send-email-jtulak@xxxxxxxxxx> <20150804084625.GB12844@xxxxxxxxxxxxx>
Thread-index: aQVV3HpZwNRI0tBIINsG7WTyCs2beA==
Thread-topic: xfsprogs: Add ifdef dirent checks where it was missing

----- Original Message -----
> From: "Christoph Hellwig" <hch@xxxxxxxxxxxxx>
> To: "Jan Tulak" <jtulak@xxxxxxxxxx>
> Cc: hch@xxxxxxxxxxxxx, xfs@xxxxxxxxxxx
> Sent: Tuesday, August 4, 2015 10:46:25 AM
> Subject: Re: [PATCH v3 04/11] xfsprogs: Add ifdef dirent checks where it was  
> missing
> 
> > diff --git a/io/readdir.c b/io/readdir.c
> > index 20b8898..ed8f04d 100644
> > --- a/io/readdir.c
> > +++ b/io/readdir.c
> > @@ -104,12 +104,16 @@ read_directory(
> >             if (!dirent)
> >                     break;
> >  
> > +#ifdef _DIRENT_HAVE_D_RECLEN
> >             *total += dirent->d_reclen;
> > +#endif
> 
> You probably want to use d_namen + sizeof(*dirent) to approimate
> the value if d_reclen doesn't exist.
> 
> >             count++;
> >  
> >             if (dump) {
> >                     dump_dirent(offset, dirent);
> > +#ifdef _DIRENT_HAVE_D_OFF
> >                     offset = dirent->d_off;
> > +#endif
> 
> We're only using the offset for dumping the value, maybe setting
> it to 0 and adding a comment explaining it should go into the else
> branch here?
> 

That sounds reasonable, sending an updated patch.

Thanks. :-)

Jan

-- 
Jan Tulak
jtulak@xxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>