Re: [PATCH] perf tools: using O_LARGEFILE to open perf data file - fix

From: H. Peter Anvin
Date: Wed Feb 03 2010 - 12:34:17 EST


On 02/03/2010 03:06 AM, Xiao Guangrong wrote:
> static void get_next_page(int cpu)
> {
> - off64_t save_seek;
> - off64_t ret;
> + s64 save_seek;
> + s64 ret;

Should be off_t (which is 64 bits with _FILE_OFFSET_BITS=64.)

>
> if (!cpu_data[cpu].page)
> return;
> @@ -298,9 +298,9 @@ static void get_next_page(int cpu)
> update_cpu_data_index(cpu);
>
> /* other parts of the code may expect the pointer to not move */
> - save_seek = lseek64(input_fd, 0, SEEK_CUR);
> + save_seek = lseek(input_fd, 0, SEEK_CUR);
>
> - ret = lseek64(input_fd, cpu_data[cpu].offset, SEEK_SET);
> + ret = lseek(input_fd, cpu_data[cpu].offset, SEEK_SET);
> if (ret < 0)
> die("failed to lseek");

Compare for equality against (off_t)-1 here.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
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/