Re: [tip:perf/core] perf probe: Don't always consider EOF as an error when listing source code

From: Franck Bui-Huu
Date: Wed Dec 22 2010 - 08:14:53 EST


tip-bot for Franck Bui-Huu <fbuihuu@xxxxxxxxx> writes:


[...]

> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 3ba9c53..80cc0bc 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -287,7 +287,7 @@ static int get_real_path(const char *raw_path, const char *comp_dir,
> #define LINEBUF_SIZE 256
> #define NR_ADDITIONAL_LINES 2
>
> -static int show_one_line(FILE *fp, int l, bool skip, bool show_num)
> +static int __show_one_line(FILE *fp, int l, bool skip, bool show_num)
> {
> char buf[LINEBUF_SIZE];
> const char *color = show_num ? "" : PERF_COLOR_BLUE;
> @@ -306,16 +306,30 @@ static int show_one_line(FILE *fp, int l, bool skip, bool show_num)
>
> } while (strchr(buf, '\n') == NULL);
>
> - return 0;
> + return 1;
> error:
> - if (feof(fp))
> + if (ferror(fp)) {
> pr_warning("Source file is shorter than expected.\n");
> - else
> - pr_warning("File read error: %s\n", strerror(errno));
> + return -1;

Argh, something wrong here.

The warning left here, is the wrong one, I should have left the other
one.

Sorry for the mistake.

Should I send a patch to fix that ?
--
Franck
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/