diff options
author | Robert Haas <rhaas@postgresql.org> | 2022-01-28 11:40:53 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2022-01-28 11:40:53 -0500 |
commit | 51891d5a95605c4e98324731b386345d89c5a71e (patch) | |
tree | 4d9aff5b7c8638a70f58d5c6f1bcfc0efa51ecd1 /src | |
parent | da505eafca81bc81c34f729521a42a093408cb92 (diff) | |
download | postgresql-51891d5a95605c4e98324731b386345d89c5a71e.tar.gz postgresql-51891d5a95605c4e98324731b386345d89c5a71e.zip |
pg_basebackup: Cleaner handling when compression is multiply specified.
Tushar Ahuja discovered that if you use both --compress and --gzip,
or --compress multiple times, the last instance of one of these
options doesn't in all cases overwrite the compression level set by
an earlier option. That's not a serious bug, but it also has nothing
to recommend it. Repair.
Discussion: http://postgr.es/m/CA+TgmoZfP=rsZB_9vDGfhuNgSu_M_09UWu8SjvsP65y_1pQFCg@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_basebackup/pg_basebackup.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 1f81bbf4e2a..c40925c1f04 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -966,6 +966,12 @@ parse_compress_options(char *src, WalCompressionMethod *methodres, int firstlen; char *firstpart; + /* + * clear 'levelres' so that if there are multiple compression options, + * the last one fully overrides the earlier ones + */ + *levelres = 0; + /* check if the option is split in two */ sep = strchr(src, ':'); |