tracing: only truncate ftrace files when O_TRUNC is set
authorSteven Rostedt <srostedt@redhat.com>
Thu, 23 Jul 2009 03:29:30 +0000 (23:29 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 23 Jul 2009 14:07:18 +0000 (10:07 -0400)
The current code will truncate the ftrace files contents if O_APPEND
is not set and the file is opened in write mode. This is incorrect.
It should only truncate the file if O_TRUNC is set. Otherwise
if one of these files is opened by a C program with fopen "r+",
it will incorrectly truncate the file.

Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c
kernel/trace/trace.c
kernel/trace/trace_events.c

Simple merge
Simple merge
Simple merge