diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-23 22:41:13 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-08-23 22:41:13 +0200 |
commit | d8744f9b77a98183ca4ecc6e0be5ce9a6e92ede0 (patch) | |
tree | 964338b93fd226198ef12a4cbd796e57db7187d0 | |
parent | 7c19363bc062efd52f54cc76a06685f9a9a757b5 (diff) | |
parent | b1eba5880803f8981d80ff452a2121407360e3d4 (diff) | |
download | ouroboros-d8744f9b77a98183ca4ecc6e0be5ce9a6e92ede0.tar.gz ouroboros-d8744f9b77a98183ca4ecc6e0be5ce9a6e92ede0.zip |
Merged in dstaesse/ouroboros/be-bugfixing (pull request #220)
irmd: Fix wrong lookup
-rw-r--r-- | src/irmd/apn_table.c | 17 | ||||
-rw-r--r-- | src/irmd/apn_table.h | 3 | ||||
-rw-r--r-- | src/irmd/main.c | 3 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/irmd/apn_table.c b/src/irmd/apn_table.c index 31c45a78..a7cf0fd3 100644 --- a/src/irmd/apn_table.c +++ b/src/irmd/apn_table.c @@ -162,3 +162,20 @@ struct apn_entry * apn_table_get(struct list_head * apn_table, char * ap) return NULL; } + +struct apn_entry * apn_table_get_by_apn(struct list_head * apn_table, + char * apn) +{ + struct list_head * p; + + if (apn_table == NULL || apn == NULL) + return NULL; + + list_for_each(p, apn_table) { + struct apn_entry * e = list_entry(p, struct apn_entry, next); + if (!strcmp(e->apn, apn)) + return e; + } + + return NULL; +} diff --git a/src/irmd/apn_table.h b/src/irmd/apn_table.h index 88a2548a..fd0fb1de 100644 --- a/src/irmd/apn_table.h +++ b/src/irmd/apn_table.h @@ -59,4 +59,7 @@ void apn_table_del(struct list_head * apn_table, struct apn_entry * apn_table_get(struct list_head * apn_table, char * ap); +struct apn_entry * apn_table_get_by_apn(struct list_head * apn_table, + char * apn); + #endif /* OUROBOROS_IRMD_APN_TABLE_H */ diff --git a/src/irmd/main.c b/src/irmd/main.c index 5366b535..8ac645df 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1364,7 +1364,8 @@ static struct irm_flow * flow_req_arr(pid_t api, pthread_mutex_lock(&re->state_lock); re->state = REG_NAME_AUTO_EXEC; - a = apn_table_get(&irmd->apn_table, reg_entry_get_apn(re)); + a = apn_table_get_by_apn(&irmd->apn_table, + reg_entry_get_apn(re)); pthread_mutex_unlock(&re->state_lock); if (a == NULL || (c_api->pid = auto_execute(a->argv)) < 0) { pthread_mutex_lock(&re->state_lock); |