aboutsummaryrefslogtreecommitdiff
path: root/src/test/modules/test_json_parser/test_json_parser_perf.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2024-07-09 17:29:48 -0400
committerAndrew Dunstan <andrew@dunslane.net>2024-07-09 17:29:48 -0400
commitf7bd0a381de12a5c309f3c19d8c966b77e87cff3 (patch)
tree540ec1477c7507d484fbe3d3f9f7fb8c5b4ef1f8 /src/test/modules/test_json_parser/test_json_parser_perf.c
parent896cd266fd34c2dfbf06297b9f2ea89ae8e5a0b1 (diff)
downloadpostgresql-f7bd0a381de12a5c309f3c19d8c966b77e87cff3.tar.gz
postgresql-f7bd0a381de12a5c309f3c19d8c966b77e87cff3.zip
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
Diffstat (limited to 'src/test/modules/test_json_parser/test_json_parser_perf.c')
-rw-r--r--src/test/modules/test_json_parser/test_json_parser_perf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/modules/test_json_parser/test_json_parser_perf.c b/src/test/modules/test_json_parser/test_json_parser_perf.c
index ea85626cbd8..74cc5f3f548 100644
--- a/src/test/modules/test_json_parser/test_json_parser_perf.c
+++ b/src/test/modules/test_json_parser/test_json_parser_perf.c
@@ -55,7 +55,7 @@ main(int argc, char **argv)
sscanf(argv[1], "%d", &iter);
- if ((json_file = fopen(argv[2], "r")) == NULL)
+ if ((json_file = fopen(argv[2], PG_BINARY_R)) == NULL)
pg_fatal("Could not open input file '%s': %m", argv[2]);
while ((n_read = fread(buff, 1, 6000, json_file)) > 0)