diff --git a/tests/api-test-2.c b/tests/api-test-2.c index 12474fe2..3f4595fe 100644 --- a/tests/api-test-2.c +++ b/tests/api-test-2.c @@ -199,6 +199,11 @@ static int get_luks2_offsets(int metadata_device, struct crypt_device *cd = NULL; static uint64_t default_header_size = 0; + if (r_header_size) + *r_header_size = 0; + if (r_payload_offset) + *r_payload_offset = 0; + if (!default_header_size) { if (crypt_init(&cd, THE_LOOP_DEV)) return -EINVAL; @@ -966,8 +971,7 @@ static void AddDeviceLuks2(void) OK_(!(global_lines != 0)); reset_log(); OK_(crypt_dump_json(cd, &tmp_buf, 0)); - OK_(!tmp_buf); - OK_(!(strlen(tmp_buf) != 0)); + OK_(!(tmp_buf && strlen(tmp_buf) != 0)); FAIL_(crypt_set_uuid(cd, "blah"), "wrong UUID format"); OK_(crypt_set_uuid(cd, DEVICE_TEST_UUID)); diff --git a/tests/test_utils.c b/tests/test_utils.c index bc0bd10a..707f36a9 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -214,7 +214,6 @@ int get_key_dm(const char *name, char *buffer, unsigned int buffer_size) struct dm_info dmi; uint64_t start, length; char *target_type, *key, *params; - void *next = NULL; int r = -EINVAL; if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) @@ -228,7 +227,7 @@ int get_key_dm(const char *name, char *buffer, unsigned int buffer_size) if (!dmi.exists) goto out; - next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms); + dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms); if (!target_type || strcmp(target_type, "crypt") != 0) goto out;