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

Commit4b529f4

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 parentb7f37af commit4b529f4

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
@@ -706,7 +706,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
706706
returnNULL;
707707

708708
/* Turn off compression for header */
709-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
709+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
710710
{
711711
tar_set_error("could not change compression parameters");
712712
returnNULL;
@@ -746,7 +746,8 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
746746
returnNULL;
747747

748748
/* Re-enable compression for the rest of the file */
749-
if (deflateParams(tar_data->zp,tar_data->compression,0)!=Z_OK)
749+
if (deflateParams(tar_data->zp,tar_data->compression,
750+
Z_DEFAULT_STRATEGY)!=Z_OK)
750751
{
751752
tar_set_error("could not change compression parameters");
752753
returnNULL;
@@ -960,7 +961,7 @@ tar_close(Walfile f, WalCloseMethod method)
960961
else
961962
{
962963
/* Turn off compression */
963-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
964+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
964965
{
965966
tar_set_error("could not change compression parameters");
966967
return-1;
@@ -972,7 +973,8 @@ tar_close(Walfile f, WalCloseMethod method)
972973
return-1;
973974

974975
/* Turn compression back on */
975-
if (deflateParams(tar_data->zp,tar_data->compression,0)!=Z_OK)
976+
if (deflateParams(tar_data->zp,tar_data->compression,
977+
Z_DEFAULT_STRATEGY)!=Z_OK)
976978
{
977979
tar_set_error("could not change compression parameters");
978980
return-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp