Skip to content
Snippets Groups Projects
Commit 0f965db5 authored by Konstantin Belyavskiy's avatar Konstantin Belyavskiy Committed by Konstantin Osipov
Browse files

[FreeBSD] Fix FreeBSD build

Under FreeBSD getline prototype is not provided by
default due to compatibility problems.
Get rid of getline (use fgets instead).
Based on @locker proposal.

Closes #3217.
parent 7f157a8f
No related branches found
No related tags found
No related merge requests found
......@@ -171,18 +171,18 @@ int main()
log_say(&test_log, 0, NULL, 0, NULL, "hello %s", "user");
FILE* fd = fopen(tmp_filename, "r");
char *line = NULL;
size_t len = 0;
const size_t len = 4096;
char line[len];
if (getline(&line, &len, fd) != -1) {
if (fgets(line, len, fd) != NULL) {
ok(strstr(line, "hello user") != NULL, "plain");
getline(&line, &len, fd);
fgets(line, len, fd);
}
if (getline(&line, &len, fd) != -1) {
if (fgets(line, len, fd) != NULL) {
ok(strstr(line, "\"message\": \"hello user\"") != NULL, "json");
}
if (getline(&line, &len, fd) != -1) {
if (fgets(line, len, fd) != NULL) {
ok(strstr(line, "\"msg\" = \"hello user\"") != NULL, "custom");
}
log_destroy(&test_log);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment