From f4e290229b240a3af4d22bb3df5125760ebe8acc Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 20 Jul 2015 23:30:44 -0500 Subject: [PATCH] Doing stuff? --- include/patty/ax25.h | 6 +++--- src/ax25.c | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/patty/ax25.h b/include/patty/ax25.h index 8c13415..a686fd5 100644 --- a/include/patty/ax25.h +++ b/include/patty/ax25.h @@ -46,9 +46,9 @@ typedef struct _patty_ax25_if { } patty_ax25_if; typedef struct _patty_ax25 { - patty_dict * ax25_ifs; /* Key: AX.25 interface name */ - patty_dict * ports; /* Key: Integer port descriptor */ - patty_dict * links; /* Key: Integer link descriptor */ + patty_dict * ifaces; /* Key: AX.25 interface name */ + patty_dict * ports; /* Key: Integer port descriptor */ + patty_dict * links; /* Key: Integer link descriptor */ } patty_ax25; int patty_ax25_init(patty_ax25 *ax25); diff --git a/src/ax25.c b/src/ax25.c index 813a1e8..6861b6a 100644 --- a/src/ax25.c +++ b/src/ax25.c @@ -9,8 +9,8 @@ int patty_ax25_init(patty_ax25 *ax25) { memset(ax25, '\0', sizeof(*ax25)); - if ((ax25->ax25_ifs = patty_dict_new()) == NULL) { - goto error_dict_new_ax25_ifs; + if ((ax25->ifaces = patty_dict_new()) == NULL) { + goto error_dict_new_ifaces; } if ((ax25->ports = patty_dict_new()) == NULL) { @@ -27,16 +27,16 @@ error_dict_new_links: patty_dict_destroy(ax25->ports); error_dict_new_ports: - patty_dict_destroy(ax25->ax25_ifs); + patty_dict_destroy(ax25->ifaces); -error_dict_new_ax25_ifs: +error_dict_new_ifaces: return -1; } void patty_ax25_finish(patty_ax25 *ax25) { patty_dict_destroy(ax25->links); patty_dict_destroy(ax25->ports); - patty_dict_destroy(ax25->ax25_ifs); + patty_dict_destroy(ax25->ifaces); } static int create_if_tnc(patty_ax25 *ax25, const char *device) { @@ -56,8 +56,15 @@ static int create_if_tnc(patty_ax25 *ax25, const char *device) { goto error_kiss_tnc_open; } + if (patty_dict_set(ax25->ifaces, (void *)device, strlen(device), iface) == NULL) { + goto error_dict_set_iface; + } + return 0; +error_dict_set_iface: + patty_kiss_tnc_close(iface->tnc); + error_kiss_tnc_open: patty_dict_destroy(iface->ports);