Skip to content

Commit

Permalink
acutest_is_tracer_present_: Avoid variable length array warning...
Browse files Browse the repository at this point in the history
with clang 10 (with -Wall -Wextra -pedantic).

Fixes #67.
  • Loading branch information
mity committed Aug 4, 2021
1 parent 1849c02 commit cce3007
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/acutest.h
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ acutest_is_tracer_present_(void)
/* Must be large enough so the line 'TracerPid: ${PID}' can fit in. */
static const int OVERLAP = 32;

char buf[256+OVERLAP+1];
char buf[512];
int tracer_present = 0;
int fd;
size_t n_read = 0;
Expand Down Expand Up @@ -1625,8 +1625,10 @@ acutest_is_tracer_present_(void)
break;
}

if(n_read == sizeof(buf)-1) {
memmove(buf, buf + sizeof(buf)-1 - OVERLAP, OVERLAP);
if(n_read == sizeof(buf) - 1) {
/* Move the tail with the potentially incomplete line we're looking
* for to the beginning of the buffer. */
memmove(buf, buf + sizeof(buf) - 1 - OVERLAP, OVERLAP);
n_read = OVERLAP;
} else {
break;
Expand Down

0 comments on commit cce3007

Please sign in to comment.