* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#define _GNU_SOURCE
#include "utils.h"
#include "options.h"
return false;
argn = 2;
- args = malloc(argn * sizeof(arg));
+ args = calloc(argn, sizeof(arg));
if (!args)
return false;
list_for_each_entry(type, &s->datatypes, list)
{
- sprintf(buf, "%s_%s", type->dest ? "dst" : "src",
- fw3_ipset_type_names[type->type]);
-
+ sprintf(buf, "%s_%s", type->dir, fw3_ipset_type_names[type->type]);
ptr.o = NULL;
ptr.option = "match";
ptr.value = buf;
free(obj);
}
+void
+fw3_free_list(struct list_head *head)
+{
+ struct list_head *entry, *tmp;
+
+ if (!head)
+ return;
+
+ list_for_each_safe(entry, tmp, head)
+ {
+ list_del(entry);
+ free(entry);
+ }
+
+ free(head);
+}
bool
fw3_hotplug(bool add, void *zone, void *device)
close(0);
close(1);
close(2);
- chdir("/");
+ if (chdir("/")) {};
clearenv();
setenv("ACTION", add ? "add" : "remove", 1);