From: Eric Bollengier Date: Fri, 17 Nov 2023 09:05:45 +0000 (+0100) Subject: Fix restore issue when compression is enabled but not available X-Git-Tag: Beta-15.0.1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1509972775142a29743b91506d4e81b614561d30;p=thirdparty%2Fbacula.git Fix restore issue when compression is enabled but not available --- diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index c91caba82..e2d42e24a 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -2082,33 +2082,37 @@ static int set_options(findFOPTS *fo, const char *opts) case 'Z': /* compression */ p++; /* skip Z */ if (*p >= '0' && *p <= '9') { - fo->flags |= FO_COMPRESS; - fo->Compress_algo = COMPRESS_GZIP; - fo->Compress_level = *p - '0'; - } - else if (*p == 'o') { - fo->flags |= FO_COMPRESS; - fo->Compress_algo = COMPRESS_LZO1X; - fo->Compress_level = 1; /* not used with LZO */ - } - else if (*p >= 'r' && *p <= 'u') { - fo->flags |= FO_COMPRESS; - fo->Compress_algo = COMPRESS_ZSTD; - switch(*p) { - case 'u': - fo->Compress_level = 10; - break; - case 'r': - fo->Compress_level = 1; - break; - case 't': - fo->Compress_level = 19; - break; - case 's': - default: - fo->Compress_level = 3; - break; - } +#ifdef HAVE_ZLIB + fo->flags |= FO_COMPRESS; + fo->Compress_algo = COMPRESS_GZIP; + fo->Compress_level = *p - '0'; +#endif // HAVE_ZLIB + } else if (*p == 'o') { +#ifdef HAVE_LZO + fo->flags |= FO_COMPRESS; + fo->Compress_algo = COMPRESS_LZO1X; + fo->Compress_level = 1; /* not used with LZO */ +#endif // HAVE_LZO + } else if (*p >= 'r' && *p <= 'u') { +#ifdef HAVE_ZSTD + fo->flags |= FO_COMPRESS; + fo->Compress_algo = COMPRESS_ZSTD; + switch(*p) { + case 'u': + fo->Compress_level = 10; + break; + case 'r': + fo->Compress_level = 1; + break; + case 't': + fo->Compress_level = 19; + break; + case 's': + default: + fo->Compress_level = 3; + break; + } +#endif // HAVE_ZSTD } else { Dmsg1(10, "Ignore unknown compression code Z%c in the FileSet\n", *p); }