Skip to content

Commit

Permalink
replace VLA formatting buffer with dprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Mar 2, 2020
1 parent 08279e2 commit 6a18bd5
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions libc/bionic/bionic_systrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

#include <cutils/trace.h> // For ATRACE_TAG_BIONIC.

#define WRITE_OFFSET 32

static Lock g_lock;
static CachedProperty g_debug_atrace_tags_enableflags("debug.atrace.tags.enableflags");
static uint64_t g_tags;
Expand Down Expand Up @@ -61,15 +59,9 @@ void bionic_trace_begin(const char* message) {
return;
}

// If bionic tracing has been enabled, then write the message to the
// kernel trace_marker.
int length = strlen(message);
char buf[length + WRITE_OFFSET];
size_t len = snprintf(buf, length + WRITE_OFFSET, "B|%d|%s", getpid(), message);

// Tracing may stop just after checking property and before writing the message.
// So the write is acceptable to fail. See b/20666100.
TEMP_FAILURE_RETRY(write(trace_marker_fd, buf, len));
dprintf(trace_marker_fd, "B|%d|%s", getpid(), message);
}

void bionic_trace_end() {
Expand Down

0 comments on commit 6a18bd5

Please sign in to comment.