]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Report one error less when getting net dev speed
authorJán Tomko <jtomko@redhat.com>
Mon, 30 Jun 2014 13:00:33 +0000 (15:00 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 1 Jul 2014 14:33:14 +0000 (16:33 +0200)
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

src/util/virnetdev.c

index a551f9820b97aac41bbcb19c84d102c0ec3bd0aa..fc9ec1e4b8f1fd416770ca920868292bac1dc438 100644 (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;