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.
This commit is contained in:
Lennart Poettering 2015-12-09 17:41:33 +01:00
parent d12bf2bdff
commit c296dd2eea
1 changed files with 2 additions and 0 deletions

View File

@ -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)