ethtool: make ethtool_get_driver() return -ENODATA if ioctl succeeds but driver name is empty

Inspired by #17532.
This commit is contained in:
Yu Watanabe 2020-11-10 01:14:38 +09:00
parent a93187ced5
commit 861de64e68
1 changed files with 3 additions and 0 deletions

View File

@ -197,6 +197,9 @@ int ethtool_get_driver(int *ethtool_fd, const char *ifname, char **ret) {
if (r < 0)
return -errno;
if (isempty(ecmd.driver))
return -ENODATA;
d = strdup(ecmd.driver);
if (!d)
return -ENOMEM;