dhcp/nettools: fix error code for FQDN name-too-long check

Use NM_UTILS_ERROR_UNKNOWN explicitly instead of the unrelated variable
'r', which happens to be 0 at this point from a prior unrelated call.

Fixes: aa8d5a3e9e ('dhcp: support FQDN flags in the nettools backend')
This commit is contained in:
Beniamino Galvani 2026-05-30 22:07:25 +02:00
parent 061d32a02e
commit f27b67cd65

View file

@ -1470,7 +1470,9 @@ ip4_start(NMDhcpClient *client, GError **error)
} else {
fqdn_len = strlen(client_config->hostname);
if (fqdn_len > sizeof(buffer) - 3) {
nm_utils_error_set(error, r, "failed to set DHCP FQDN: name too long");
nm_utils_error_set_literal(error,
NM_UTILS_ERROR_UNKNOWN,
"failed to set DHCP FQDN: name too long");
return FALSE;
}
memcpy(buffer + 3, client_config->hostname, fqdn_len);