<div dir="ltr">I agree. Thanks for pointing out that this is a behavioural change, which should not happen.<div><br>I should be doing something like this:<div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">if (virFileReadAllQuiet(path, 1024, &buf) < 0 ) {</span><br></div><div><span style="font-size:12.8px">    if (</span><span style="font-size:12.8px">errno != ENOENT) {</span></div><div><span style="font-size:12.8px">        </span><span style="font-size:12.8px">virReportSystemError(errno,</span></div><div><span style="font-size:12.8px">                                   </span><span style="font-size:12.8px">_("unable to read: %s"), path);</span><span style="font-size:12.8px">                      </span></div><div><span style="font-size:12.8px">    }</span></div><div><span style="font-size:12.8px">   goto cleanup;</span></div><div><span style="font-size:12.8px">}</span></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 1:56 PM, Peter Krempa <span dir="ltr"><<a href="mailto:pkrempa@redhat.com" target="_blank">pkrempa@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Mar 22, 2017 at 09:14:41 +0100, Peter Krempa wrote:<br>
> On Wed, Mar 22, 2017 at 01:02:18 -0700, Prerna Saxena wrote:<br>
> > Sample from current logs:<br>
> > error : virFileReadAll:1290 : Failed to open file '/sys/class/net/tap3/<wbr>operstate': No such file or directory<br>
> > error : virNetDevGetLinkInfo:1895 : unable to read: /sys/class/net/tap3/operstate: No such file or directory<br>
> ><br>
> > These have no useful data point and are redundant.<br>
> ><br>
> > Signed-off-by: Prerna Saxena <<a href="mailto:saxenap.ltc@gmail.com">saxenap.ltc@gmail.com</a>><br>
> > ---<br>
> >  src/util/virnetdev.c | 2 +-<br>
> >  1 file changed, 1 insertion(+), 1 deletion(-)<br>
> ><br>
> > diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c<br>
> > index d123248..3e2f962 100644<br>
> > --- a/src/util/virnetdev.c<br>
> > +++ b/src/util/virnetdev.c<br>
> > @@ -1874,7 +1874,7 @@ virNetDevGetLinkInfo(const char *ifname,<br>
> >      if (virNetDevSysfsFile(&path, ifname, "operstate") < 0)<br>
> >          goto cleanup;<br>
> ><br>
> > -    if (virFileReadAll(path, 1024, &buf) < 0) {<br>
> > +    if (virFileReadAllQuiet(path, 1024, &buf) < 0 && errno != ENOENT) {<br>
> >          virReportSystemError(errno,<br>
> >                               _("unable to read: %s"),<br>
> >                               path);<br>
><br>
> Remove this message here instead of switching to virFileReadAllQuiet.<br>
> virFileReadAll reports messages according to the failure itself.<br>
<br>
</div></div>Hmm, So you want to avoid the error message altogether. So in that case<br>
you should rather call virFileAccess and also note what happens in an<br>
comment.<br>
<br>
Additionally since that would be a semantic change you need to mention<br>
it in the commit message and also make sure that all callers would<br>
ignore such failure. Otherwise you may cause a regression where we'd<br>
report an "unknown error" in cases where it was actually necessary.<br>
<br>
Since I found at least one code path that propagates the error<br>
(nodeDeviceGetXMLDesc) you should re-evaluate your approach.<br>
</blockquote></div><br></div>