Fix gcrypt detection & compatimage in api-test.
authorMilan Broz <gmazyland@gmail.com>
Sat, 1 May 2010 09:59:12 +0000 (09:59 +0000)
committerMilan Broz <gmazyland@gmail.com>
Sat, 1 May 2010 09:59:12 +0000 (09:59 +0000)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@212 36d66b0a-2a48-0410-832c-cd162a569da5

tests/api-test.c

index bf38e11..c24324c 100644 (file)
@@ -169,8 +169,10 @@ static void _setup(void)
 
        r = system("dmsetup create " DEVICE_EMPTY_name " --table \"0 10000 zero\"");
        r = system("dmsetup create " DEVICE_ERROR_name " --table \"0 10000 error\"");
-       if (!strncmp("/dev/loop", DEVICE_1, 9))
+       if (!strncmp("/dev/loop", DEVICE_1, 9)) {
+               r = system(" [ ! -e " IMAGE1 " ] && bzip2 -dk " IMAGE1 ".bz2");
                r = system("losetup " DEVICE_1 " " IMAGE1);
+       }
        if (!strncmp("/dev/loop", DEVICE_2, 9)) {
                r = system("dd if=/dev/zero of=" IMAGE_EMPTY " bs=1M count=4");
                r = system("losetup " DEVICE_2 " " IMAGE_EMPTY);
@@ -729,7 +731,7 @@ static void _gcrypt_compatible()
        if (!(f = popen("libgcrypt-config --version", "r")))
                return;
 
-       if (fscanf(f, "%d.%d.%d", &maj, &min, &patch) == 2 &&
+       if (fscanf(f, "%d.%d.%d", &maj, &min, &patch) == 3 &&
            maj >= 1 && min >= 4)
                gcrypt_compatible = 1;
        if (_debug)