From f7bd0a381de12a5c309f3c19d8c966b77e87cff3 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Tue, 9 Jul 2024 17:29:48 -0400 Subject: Prevent CRLF conversion of inputs in json_parser test module Do this by opening the file in PG_BINARY_R mode. This prevents us from getting wrong byte count from stat(). Per complaint from Andres Freund Discussion: https://postgr.es/m/20240707052030.r77hbdkid3mwksop@awork3.anarazel.de Backpatch to rlease 17 where this code was introduced --- src/test/modules/test_json_parser/test_json_parser_incremental.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/modules/test_json_parser/test_json_parser_incremental.c') diff --git a/src/test/modules/test_json_parser/test_json_parser_incremental.c b/src/test/modules/test_json_parser/test_json_parser_incremental.c index f4c442ac365..47040e1e421 100644 --- a/src/test/modules/test_json_parser/test_json_parser_incremental.c +++ b/src/test/modules/test_json_parser/test_json_parser_incremental.c @@ -124,7 +124,7 @@ main(int argc, char **argv) makeJsonLexContextIncremental(&lex, PG_UTF8, need_strings); initStringInfo(&json); - if ((json_file = fopen(testfile, "r")) == NULL) + if ((json_file = fopen(testfile, PG_BINARY_R)) == NULL) pg_fatal("error opening input: %m"); if (fstat(fileno(json_file), &statbuf) != 0) -- cgit v1.2.3