aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/header.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 3b833f06c4e7..8dda19b68ac4 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -74,6 +74,7 @@ bool perf_header__has_feat(const struct perf_header *header, int feat)
74 return test_bit(feat, header->adds_features); 74 return test_bit(feat, header->adds_features);
75} 75}
76 76
77/* Return: 0 if succeded, -ERR if failed. */
77static int do_write(int fd, const void *buf, size_t size) 78static int do_write(int fd, const void *buf, size_t size)
78{ 79{
79 while (size) { 80 while (size) {
@@ -89,6 +90,7 @@ static int do_write(int fd, const void *buf, size_t size)
89 return 0; 90 return 0;
90} 91}
91 92
93/* Return: 0 if succeded, -ERR if failed. */
92int write_padded(int fd, const void *bf, size_t count, size_t count_aligned) 94int write_padded(int fd, const void *bf, size_t count, size_t count_aligned)
93{ 95{
94 static const char zero_buf[NAME_ALIGN]; 96 static const char zero_buf[NAME_ALIGN];
@@ -103,6 +105,7 @@ int write_padded(int fd, const void *bf, size_t count, size_t count_aligned)
103#define string_size(str) \ 105#define string_size(str) \
104 (PERF_ALIGN((strlen(str) + 1), NAME_ALIGN) + sizeof(u32)) 106 (PERF_ALIGN((strlen(str) + 1), NAME_ALIGN) + sizeof(u32))
105 107
108/* Return: 0 if succeded, -ERR if failed. */
106static int do_write_string(int fd, const char *str) 109static int do_write_string(int fd, const char *str)
107{ 110{
108 u32 len, olen; 111 u32 len, olen;
@@ -3200,7 +3203,8 @@ int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd,
3200 */ 3203 */
3201 tracing_data_put(tdata); 3204 tracing_data_put(tdata);
3202 3205
3203 write_padded(fd, NULL, 0, padding); 3206 if (write_padded(fd, NULL, 0, padding))
3207 return -1;
3204 3208
3205 return aligned_size; 3209 return aligned_size;
3206} 3210}