summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-25 11:20:16 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-25 11:20:16 +0100
commit5ae1fb3db5bf11ee2159b8461cdf1e54a2a0ef45 (patch)
tree75bbe4ec07abb96119f153a7bf687b187ff868b6 /src/ipcpd
parent23e29ee36bb032040bb5dab96e940f5348bcc0bf (diff)
downloadouroboros-5ae1fb3db5bf11ee2159b8461cdf1e54a2a0ef45.tar.gz
ouroboros-5ae1fb3db5bf11ee2159b8461cdf1e54a2a0ef45.zip
ipcpd: Check for duplicate RO in flat addr policy
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/normal/pol/flat.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ipcpd/normal/pol/flat.c b/src/ipcpd/normal/pol/flat.c
index 8a0570f8..82c7db93 100644
--- a/src/ipcpd/normal/pol/flat.c
+++ b/src/ipcpd/normal/pol/flat.c
@@ -238,12 +238,22 @@ uint64_t flat_address(void)
}
pthread_mutex_lock(&flat.lock);
+
+ if (ro_exists(ro_name)) {
+ pthread_mutex_unlock(&flat.lock);
+ free(ro_name);
+ free(buf);
+ continue;
+ }
+
+
if (ro_create(ro_name, &attr, buf, sizeof(*msg))) {
pthread_mutex_unlock(&flat.lock);
free(ro_name);
free(buf);
return INVALID_ADDR;
}
+
free(ro_name);
while (flat.addr_in_use == false) {
@@ -253,6 +263,7 @@ uint64_t flat_address(void)
if (ret == -ETIMEDOUT)
break;
}
+
pthread_mutex_unlock(&flat.lock);
}