summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-09 17:41:33 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-10 11:28:02 +0100
commitc296dd2eea308e9ef73eb81f31e9eeaa32c30895 (patch)
treea1d749c110f1d5d4597274b36029c6dc1f834317 /src/resolve
parentd12bf2bdff8d616b7e59fc480c7e610003b494df (diff)
resolved: refuse modifying DnsAnswer objects that have more than one reference
DnsAnswer objects should be considered immutable after having passed to more than one user, i.e. with a reference counter > 1. Enforce that in code, so that we can track down misuses easier.
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-dns-answer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c
index 14cba39ad2..f1f4d909cc 100644
--- a/src/resolve/resolved-dns-answer.c
+++ b/src/resolve/resolved-dns-answer.c
@@ -81,6 +81,8 @@ int dns_answer_add(DnsAnswer *a, DnsResourceRecord *rr, int ifindex) {
if (!a)
return -ENOSPC;
+ if (a->n_ref > 1)
+ return -EBUSY;
for (i = 0; i < a->n_rrs; i++) {
if (a->items[i].ifindex != ifindex)