On Tue, 2006-12-19 at 08:17 +0100, Jens Axboe wrote:
> On Mon, Dec 18 2006, Ming Zhang wrote:
> > On Mon, 2006-12-18 at 10:54 -0500, Alan D. Brunelle wrote:
> > > (Hopefully this works better than my last patch attempt - Jens: the 
> > > other patches got put on the back burner for some work-related stuff, 
> > > I'll get to those in the New Year.)
> > > 
> > > Alan
> > > plain text document attachment (bp-fix-empties)
> > > Fix problem where empty input files cause premature parsing of files.
> > > 
> > > From: Alan D. Brunelle <[EMAIL PROTECTED]>
> > > 
> > > Had a problem where CPU 0 opened a file with 0 traces, and that caused the
> > > run to end before processing other trace files.
> > > ---
> > > 
> > >  blkparse.c |    4 +++-
> > >  1 files changed, 3 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/blkparse.c b/blkparse.c
> > > index bded2f8..0d2ea12 100644
> > > --- a/blkparse.c
> > > +++ b/blkparse.c
> > > @@ -2249,8 +2249,10 @@ static int setup_file(struct per_dev_inf
> > >  
> > >   snprintf(pci->fname + len, sizeof(pci->fname)-1-len,
> > >            "%s.blktrace.%d", pdi->name, pci->cpu);
> > > - if (stat(pci->fname, &st) < 0 || !st.st_size)
> > > + if (stat(pci->fname, &st) < 0)
> > >           return 0;
> > > + if (!st.st_size)
> > > +         return 1;
> > 
> > 
> > not picky but what if i do blkparse from a fifo? will this work?
> 
> It can't make things worse, as 0 is the failure condition. Alans change
> makes sense, we will just read 0 events from the descriptor.
> 

yes, not worse, just not fixed.

i know this is rarely happen. but if somebody do blkparse -i xyz and xyz
is a fifo file (feed data by netcat or any fancy stuff), then setup_file
will return 1. then blkparse behave incorrectly. and "blkparse -h" does
not explicitly ban the use of fifo.



-
To unsubscribe from this list: send the line "unsubscribe linux-btrace" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to