udev: log when we fail to query ID_NET_DRIVER

Inspired by #17532.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-11-09 15:39:29 +01:00
parent a1b24ee147
commit d61db498bf
1 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,10 @@ static int builtin_net_setup_link(sd_device *dev, int argc, char **argv, bool te
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
r = link_get_driver(ctx, dev, &driver);
if (r >= 0)
if (r < 0)
log_device_full_errno(dev, r == -EOPNOTSUPP ? LOG_DEBUG : LOG_WARNING,
r, "Failed to query device driver: %m");
else
udev_builtin_add_property(dev, test, "ID_NET_DRIVER", driver);
r = link_config_get(ctx, dev, &link);