Commit 4e11b42e authored by Libor Peltan's avatar Libor Peltan

eliminated compile warnings: deprecated readdir_r -> readdir; Wuninitialized...

eliminated compile warnings: deprecated readdir_r -> readdir; Wuninitialized few variables on make check
parent 03c4631e
......@@ -101,17 +101,17 @@ static int entity_list(const char *entity, void *_ctx, dnssec_list_t *names)
return DNSSEC_NOT_FOUND;
}
int error;
struct dirent entry, *result;
while (error = readdir_r(dir, &entry, &result), error == 0 && result) {
char *zone = file_to_entity(entity, entry.d_name);
errno = 0;
struct dirent *result;
while ((result = readdir(dir)) != NULL) {
char *zone = file_to_entity(entity, result->d_name);
if (zone) {
dnssec_list_append(names, zone);
}
}
if (error != 0) {
return dnssec_errno_to_error(error);
if (errno != 0) {
return dnssec_errno_to_error(errno);
}
return DNSSEC_EOK;
......
......@@ -315,18 +315,18 @@ static int pkcs8_dir_list(void *_handle, dnssec_list_t **list_ptr)
return DNSSEC_ENOMEM;
}
int error;
struct dirent entry, *result;
while (error = readdir_r(dir, &entry, &result), error == 0 && result) {
char *keyid = filename_to_keyid(entry.d_name);
errno = 0;
struct dirent *result;
while ((result = readdir(dir)) != NULL) {
char *keyid = filename_to_keyid(result->d_name);
if (keyid) {
dnssec_list_append(list, keyid);
}
}
if (error != 0) {
if (errno != 0) {
dnssec_list_free_full(list, NULL, NULL);
return dnssec_errno_to_error(error);
return dnssec_errno_to_error(errno);
}
*list_ptr = list;
......
......@@ -48,6 +48,7 @@ int test__date_to_timestamp(void)
gmtime_r(&ref_timestamp, &result));
// Get testing timestamp.
test_timestamp = 0U; // prevents Wunitialized
date_to_timestamp(buffer, &test_timestamp);
// Some continuous loging.
......
......@@ -126,6 +126,7 @@ static void check_set(
}
uint8_t section_code, item_code;
section_code = 0, item_code = 0; // prevents Wuninitialized
ok(db_code(conf, txn, KEY0_ROOT, key0, DB_GET, &section_code) == KNOT_EOK,
"Get DB section code");
if (key1 != NULL) {
......@@ -418,6 +419,7 @@ static void test_conf_db_iter(conf_t *conf, knot_db_txn_t *txn)
while (ret == KNOT_EOK) {
const uint8_t *id;
size_t id_len;
id = NULL, id_len = 0; // prevents Wuinitialized
ret = conf_db_iter_id(conf, &iter, &id, &id_len);
ok(ret == KNOT_EOK, "Get iteration id");
ok(id_len == strlen(names[count]), "Compare iteration id length");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment