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

Commit31156ce

Browse files
committed
Fix oversights in pg_basebackup's -z (compression) option.
The short-form -z switch didn't work, for lack of telling getopt_longabout it; and even if specified long-form, it failed to do anything,because the various tests elsewhere in the file would takeZ_DEFAULT_COMPRESSION (which is -1) as meaning "don't compress".Per bug #6060 from Shigehiro Honda, though I editorialized on his patcha bit.
1 parent264a6b1 commit31156ce

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
264264
if (strcmp(basedir,"-")==0)
265265
{
266266
#ifdefHAVE_LIBZ
267-
if (compresslevel>0)
267+
if (compresslevel!=0)
268268
{
269269
ztarfile=gzdopen(dup(fileno(stdout)),"wb");
270270
if (gzsetparams(ztarfile,compresslevel,Z_DEFAULT_STRATEGY)!=Z_OK)
@@ -281,7 +281,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
281281
else
282282
{
283283
#ifdefHAVE_LIBZ
284-
if (compresslevel>0)
284+
if (compresslevel!=0)
285285
{
286286
snprintf(fn,sizeof(fn),"%s/base.tar.gz",basedir);
287287
ztarfile=gzopen(fn,"wb");
@@ -305,7 +305,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
305305
* Specific tablespace
306306
*/
307307
#ifdefHAVE_LIBZ
308-
if (compresslevel>0)
308+
if (compresslevel!=0)
309309
{
310310
snprintf(fn,sizeof(fn),"%s/%s.tar.gz",basedir,PQgetvalue(res,rownum,0));
311311
ztarfile=gzopen(fn,"wb");
@@ -325,7 +325,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
325325
}
326326

327327
#ifdefHAVE_LIBZ
328-
if (compresslevel>0)
328+
if (compresslevel!=0)
329329
{
330330
if (!ztarfile)
331331
{
@@ -976,7 +976,7 @@ main(int argc, char **argv)
976976
}
977977
}
978978

979-
while ((c=getopt_long(argc,argv,"D:F:l:Z:c:h:p:U:xwWvP",
979+
while ((c=getopt_long(argc,argv,"D:F:xl:zZ:c:h:p:U:wWvP",
980980
long_options,&option_index))!=-1)
981981
{
982982
switch (c)
@@ -1089,7 +1089,7 @@ main(int argc, char **argv)
10891089
/*
10901090
* Mutually exclusive arguments
10911091
*/
1092-
if (format=='p'&&compresslevel>0)
1092+
if (format=='p'&&compresslevel!=0)
10931093
{
10941094
fprintf(stderr,
10951095
_("%s: only tar mode backups can be compressed\n"),
@@ -1100,7 +1100,7 @@ main(int argc, char **argv)
11001100
}
11011101

11021102
#ifndefHAVE_LIBZ
1103-
if (compresslevel>0)
1103+
if (compresslevel!=0)
11041104
{
11051105
fprintf(stderr,
11061106
_("%s: this build does not support compression\n"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp