diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-12-09 17:41:33 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-12-10 11:28:02 +0100 |
commit | c296dd2eea308e9ef73eb81f31e9eeaa32c30895 (patch) | |
tree | a1d749c110f1d5d4597274b36029c6dc1f834317 /src/resolve | |
parent | d12bf2bdff8d616b7e59fc480c7e610003b494df (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.c | 2 |
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) |