]> granicus.if.org Git - xz/commitdiff
Fix handling of integrity check type in the xz command line tool.
authorLasse Collin <lasse.collin@tukaani.org>
Fri, 13 Feb 2009 15:30:30 +0000 (17:30 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 13 Feb 2009 15:30:30 +0000 (17:30 +0200)
src/xz/args.c
src/xz/process.c

index 31ff0e585a591661e4822a68cc0a70d423a87e4e..29abf9714bf7712d3013b7a0b9e14a1eff7dc324 100644 (file)
@@ -294,10 +294,17 @@ parse_real(args_info *args, int argc, char **argv)
                        size_t i = 0;
                        while (strcmp(types[i].str, optarg) != 0) {
                                if (++i == ARRAY_SIZE(types))
-                                       message_fatal(_("%s: Unknown integrity"
+                                       message_fatal(_("%s: Unsupported "
+                                                       "integrity "
                                                        "check type"), optarg);
                        }
 
+                       // Use a separate check in case we are using different
+                       // liblzma than what was used to compile us.
+                       if (!lzma_check_is_supported(types[i].check))
+                               message_fatal(_("%s: Unsupported integrity "
+                                               "check type"), optarg);
+
                        coder_set_check(types[i].check);
                        break;
                }
index 59c19cd2d0e8d80608a2a0dd6ec2fad5d5b414fb..9b96654686ba20533f34db5e5ab632b3a7fc40ba 100644 (file)
@@ -51,7 +51,11 @@ static bool preset_default = true;
 static bool preset_extreme = false;
 
 /// Integrity check type
+#ifdef HAVE_CHECK_CRC64
 static lzma_check check = LZMA_CHECK_CRC64;
+#else
+static lzma_check check = LZMA_CHECK_CRC32;
+#endif
 
 
 extern void