.. | .. |
---|
3 | 3 | * Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> |
---|
4 | 4 | * |
---|
5 | 5 | */ |
---|
| 6 | +#include "trace-seq.h" |
---|
| 7 | + |
---|
6 | 8 | #include <stdio.h> |
---|
7 | 9 | #include <stdlib.h> |
---|
8 | 10 | #include <string.h> |
---|
.. | .. |
---|
98 | 100 | * @fmt: printf format string |
---|
99 | 101 | * |
---|
100 | 102 | * It returns 0 if the trace oversizes the buffer's free |
---|
101 | | - * space, 1 otherwise. |
---|
| 103 | + * space, the number of characters printed, or a negative |
---|
| 104 | + * value in case of an error. |
---|
102 | 105 | * |
---|
103 | 106 | * The tracer may use either sequence operations or its own |
---|
104 | 107 | * copy to user routines. To simplify formating of a trace |
---|
.. | .. |
---|
127 | 130 | goto try_again; |
---|
128 | 131 | } |
---|
129 | 132 | |
---|
130 | | - s->len += ret; |
---|
| 133 | + if (ret > 0) |
---|
| 134 | + s->len += ret; |
---|
131 | 135 | |
---|
132 | | - return 1; |
---|
| 136 | + return ret; |
---|
133 | 137 | } |
---|
134 | 138 | |
---|
135 | 139 | /** |
---|
.. | .. |
---|
137 | 141 | * @s: trace sequence descriptor |
---|
138 | 142 | * @fmt: printf format string |
---|
139 | 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 | + * * |
---|
140 | 148 | * The tracer may use either sequence operations or its own |
---|
141 | 149 | * copy to user routines. To simplify formating of a trace |
---|
142 | 150 | * trace_seq_printf is used to store strings into a special |
---|
.. | .. |
---|
161 | 169 | goto try_again; |
---|
162 | 170 | } |
---|
163 | 171 | |
---|
164 | | - s->len += ret; |
---|
| 172 | + if (ret > 0) |
---|
| 173 | + s->len += ret; |
---|
165 | 174 | |
---|
166 | | - return len; |
---|
| 175 | + return ret; |
---|
167 | 176 | } |
---|
168 | 177 | |
---|
169 | 178 | /** |
---|