Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
think I figured it out...
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaudill committed Aug 31, 2023
1 parent 9be5d53 commit fc0d37a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
3 changes: 1 addition & 2 deletions bin/ch-run.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ int main(int argc, char *argv[])

privs_verify_invoking();

//Z_ (atexit(warnings_reprint));
Z_ (atexit(test_exit));
Z_ (atexit(warnings_reprint));


#ifdef ENABLE_SYSLOG
Expand Down
6 changes: 0 additions & 6 deletions bin/ch_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,22 +702,16 @@ void version(void)
size_t string_append(char *addr, char *str, size_t size, size_t offset)
{
size_t written = strlen(str) + 1;
size_t foo = offset + written - 1;
printf("test num: %ld\n", foo);

if (size > (offset + written - 1)) // there is space
{
printf("got past if\n");
memcpy(addr + offset, str, written);
}

return written;
}

/* Reprint messages stored in “warnings” memory buffer. */
void warnings_reprint(void)
{
printf("calling warings_reprint\n");
size_t offset = 0;
int warn_ct = buf_strings_count(warnings, warnings_size);

Expand Down
3 changes: 1 addition & 2 deletions test/run/ch-run_misc.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,7 @@ EOF
run ch-run --warnings=1
echo "$output"
[[ $status -eq 0 ]]
#[[ $(echo "$output" | grep -Fc 'this is warning 0!') -eq 2 ]]
[[ $(echo "$output" | grep -Ec 'this is warning [0-9]*!') -eq 2 ]]
[[ $(echo "$output" | grep -Fc 'this is warning 0!') -eq 2 ]]

# Warnings list is a statically sized memory buffer. Ensure it works as
# intended by printing more warnings than can be saved to this buffer and
Expand Down

0 comments on commit fc0d37a

Please sign in to comment.