char name[64];
} ip_chain_t;
-static ip_chain_t **chain_list = NULL;
-static int chain_num = 0;
+static ip_chain_t **chain_list;
+static int chain_num;
static int iptables_config(const char *key, const char *value) {
/* int ip_value; */
ip_chain_t temp = {0};
ip_chain_t *final, **list;
char *table;
- int table_len;
char *chain;
- int chain_len;
char *value_copy;
char *fields[4];
value_copy = strdup(value);
if (value_copy == NULL) {
- char errbuf[1024];
- ERROR("strdup failed: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("strdup failed: %s", STRERRNO);
return 1;
}
table = fields[0];
chain = fields[1];
- table_len = strlen(table) + 1;
- if ((unsigned int)table_len > sizeof(temp.table)) {
+ size_t table_len = strlen(table) + 1;
+ if (table_len > sizeof(temp.table)) {
ERROR("Table `%s' too long.", table);
free(value_copy);
return 1;
}
sstrncpy(temp.table, table, table_len);
- chain_len = strlen(chain) + 1;
- if ((unsigned int)chain_len > sizeof(temp.chain)) {
+ size_t chain_len = strlen(chain) + 1;
+ if (chain_len > sizeof(temp.chain)) {
ERROR("Chain `%s' too long.", chain);
free(value_copy);
return 1;
list = realloc(chain_list, (chain_num + 1) * sizeof(ip_chain_t *));
if (list == NULL) {
- char errbuf[1024];
- ERROR("realloc failed: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("realloc failed: %s", STRERRNO);
sfree(temp.rule.comment);
return 1;
}
chain_list = list;
final = malloc(sizeof(*final));
if (final == NULL) {
- char errbuf[1024];
- ERROR("malloc failed: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("malloc failed: %s", STRERRNO);
sfree(temp.rule.comment);
return 1;
}