Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita9e99ff

Browse files
committed
Fix incorrect value for "strategy" with deflateParams() in walmethods.c
The zlib documentation mentions the values supported for the compressionstrategy, but this code has been using a hardcoded value of 0 ratherthan Z_DEFAULT_STRATEGY. This commit adjusts the code to useZ_DEFAULT_STRATEGY.Backpatch down to where this code has been added to ease the backport ofany future patch touching this area.Reported-by: Tom LaneDiscussion:https://postgr.es/m/1400032.1662217889@sss.pgh.pa.usBackpatch-through: 10
1 parent2864f77 commita9e99ff

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/bin/pg_basebackup/walmethods.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
701701
returnNULL;
702702

703703
/* Turn off compression for header */
704-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
704+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
705705
{
706706
tar_set_error("could not change compression parameters");
707707
returnNULL;
@@ -739,7 +739,8 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
739739
returnNULL;
740740

741741
/* Re-enable compression for the rest of the file */
742-
if (deflateParams(tar_data->zp,tar_data->compression,0)!=Z_OK)
742+
if (deflateParams(tar_data->zp,tar_data->compression,
743+
Z_DEFAULT_STRATEGY)!=Z_OK)
743744
{
744745
tar_set_error("could not change compression parameters");
745746
returnNULL;
@@ -953,7 +954,7 @@ tar_close(Walfile f, WalCloseMethod method)
953954
else
954955
{
955956
/* Turn off compression */
956-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
957+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
957958
{
958959
tar_set_error("could not change compression parameters");
959960
return-1;
@@ -964,7 +965,8 @@ tar_close(Walfile f, WalCloseMethod method)
964965
return-1;
965966

966967
/* Turn compression back on */
967-
if (deflateParams(tar_data->zp,tar_data->compression,0)!=Z_OK)
968+
if (deflateParams(tar_data->zp,tar_data->compression,
969+
Z_DEFAULT_STRATEGY)!=Z_OK)
968970
{
969971
tar_set_error("could not change compression parameters");
970972
return-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp