mirror of
https://github.com/systemd/systemd.git
synced 2025-07-15 20:59:12 +03:00
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:
@ -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)
|
||||
|
Reference in New Issue
Block a user