aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/traceevent/trace-seq.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/traceevent/trace-seq.c')
-rw-r--r--tools/lib/traceevent/trace-seq.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c
index 8ff1d55954d1..8d5ecd2bf877 100644
--- a/tools/lib/traceevent/trace-seq.c
+++ b/tools/lib/traceevent/trace-seq.c
@@ -100,7 +100,8 @@ static void expand_buffer(struct trace_seq *s)
100 * @fmt: printf format string 100 * @fmt: printf format string
101 * 101 *
102 * It returns 0 if the trace oversizes the buffer's free 102 * It returns 0 if the trace oversizes the buffer's free
103 * space, 1 otherwise. 103 * space, the number of characters printed, or a negative
104 * value in case of an error.
104 * 105 *
105 * The tracer may use either sequence operations or its own 106 * The tracer may use either sequence operations or its own
106 * copy to user routines. To simplify formating of a trace 107 * copy to user routines. To simplify formating of a trace
@@ -129,9 +130,10 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
129 goto try_again; 130 goto try_again;
130 } 131 }
131 132
132 s->len += ret; 133 if (ret > 0)
134 s->len += ret;
133 135
134 return 1; 136 return ret;
135} 137}
136 138
137/** 139/**
@@ -139,6 +141,10 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
139 * @s: trace sequence descriptor 141 * @s: trace sequence descriptor
140 * @fmt: printf format string 142 * @fmt: printf format string
141 * 143 *
144 * It returns 0 if the trace oversizes the buffer's free
145 * space, the number of characters printed, or a negative
146 * value in case of an error.
147 * *
142 * The tracer may use either sequence operations or its own 148 * The tracer may use either sequence operations or its own
143 * copy to user routines. To simplify formating of a trace 149 * copy to user routines. To simplify formating of a trace
144 * trace_seq_printf is used to store strings into a special 150 * trace_seq_printf is used to store strings into a special
@@ -163,9 +169,10 @@ trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args)
163 goto try_again; 169 goto try_again;
164 } 170 }
165 171
166 s->len += ret; 172 if (ret > 0)
173 s->len += ret;
167 174
168 return len; 175 return ret;
169} 176}
170 177
171/** 178/**