Report one error less when getting net dev speed

virFileReadAll already logs an error. If reading the 'speed' file
fails with EINVAL, we log an error even though we ignore it. If it
fails with other errors, we log two errors.

Use virFileReadAllQuiet - ignore EINVAL and report just one error
in other cases.

Fixes this error on libvirtd startup:
2014-06-30 12:47:14.583+0000: 20971: error : virFileReadAll:1297 :
Failed to read file '/sys/class/net/wlan0/speed': Invalid argument
This commit is contained in:
Ján Tomko 2014-06-30 15:00:33 +02:00
parent f638c13ea4
commit 1c7601f5c3

View File

@ -1891,7 +1891,7 @@ virNetDevGetLinkInfo(const char *ifname,
if (virNetDevSysfsFile(&path, ifname, "speed") < 0)
goto cleanup;
if (virFileReadAll(path, 1024, &buf) < 0) {
if (virFileReadAllQuiet(path, 1024, &buf) < 0) {
/* Some devices doesn't report speed, in which case we get EINVAL */
if (errno == EINVAL) {
ret = 0;