From: Ján Tomko Date: Mon, 30 Jun 2014 13:00:33 +0000 (+0200) Subject: Report one error less when getting net dev speed X-Git-Tag: v1.2.6~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c7601f5c37d0441396fb9a66af2400781213e0c;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index a551f9820b..fc9ec1e4b8 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -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;