On Tue, 2013-03-19 at 17:53 +0900, Namhyung Kim wrote: > From: Namhyung Kim <namhyung....@lge.com> > > Rename it to do_read and original do_read to __do_read, and check > their return value. > > Cc: Steven Rostedt <rost...@goodmis.org> > Cc: Frederic Weisbecker <fweis...@gmail.com> > Signed-off-by: Namhyung Kim <namhy...@kernel.org> > --- > tools/perf/util/trace-event-read.c | 80 > +++++++++++++++++++++++++++----------- > 1 file changed, 57 insertions(+), 23 deletions(-) > > diff --git a/tools/perf/util/trace-event-read.c > b/tools/perf/util/trace-event-read.c > index 62dd2168f4f5..87f0ccd54cdc 100644 > --- a/tools/perf/util/trace-event-read.c > +++ b/tools/perf/util/trace-event-read.c > @@ -48,7 +48,7 @@ static int long_size; > static ssize_t calc_data_size; > static bool repipe; > > -static int do_read(int fd, void *buf, int size) > +static int __do_read(int fd, void *buf, int size) > { > int rsize = size; > > @@ -61,8 +61,10 @@ static int do_read(int fd, void *buf, int size) > if (repipe) { > int retw = write(STDOUT_FILENO, buf, ret); > > - if (retw <= 0 || retw != ret) > - die("repiping input file"); > + if (retw <= 0 || retw != ret) { > + pr_debug("repiping input file");
Again, why debug and not err? > + return -1; > + } > } > > size -= ret; > @@ -72,14 +74,16 @@ static int do_read(int fd, void *buf, int size) > return rsize; > } > > -static int read_or_die(void *data, int size) > +static int do_read(void *data, int size) > { > int r; > > - r = do_read(input_fd, data, size); > - if (r <= 0) > - die("reading input file (size expected=%d received=%d)", > - size, r); > + r = __do_read(input_fd, data, size); > + if (r <= 0) { > + pr_debug("reading input file (size expected=%d received=%d)", > + size, r); > + return -1; > + } > > if (calc_data_size) > calc_data_size += r; > @@ -95,7 +99,7 @@ static void skip(int size) > > while (size) { > r = size > BUFSIZ ? BUFSIZ : size; > - read_or_die(buf, r); > + do_read(buf, r); Shouldn't this check the result of do_read()? > size -= r; > }; > } -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/