On Wed, Sep 10, 2025 at 09:52:40PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 10.09.25 21:15, Daniel P. Berrangé wrote:
> > On Wed, Sep 10, 2025 at 08:55:57PM +0300, Vladimir Sementsov-Ogievskiy 
> > wrote:
> > > On 10.09.25 12:44, Daniel P. Berrangé wrote:
> > > > > @@ -36,7 +37,11 @@ static gboolean 
> > > > > ga_channel_listen_accept(GIOChannel *channel,
> > > > >            g_warning("error converting fd to gsocket: %s", 
> > > > > strerror(errno));
> > > > >            goto out;
> > > > >        }
> > > > > -    qemu_socket_set_nonblock(client_fd);
> > > > > +    if (!qemu_set_blocking(client_fd, false, &err)) {
> > > > > +        g_warning("errer: %s", error_get_pretty(err));
> > > > s/errer/error/
> > > > 
> > > > 
> > > > This is a pre-existing problem, but none of this code should be using
> > > > g_warning. g_printerr() should have been used for printing error
> > > > messages. I'm not expecting you to fix that, just an observation.
> > > 
> > > 
> > > Why not g_error()? I see some g_warnings in qga code a correct 
> > > "warnings", not "errors".. And if we use sometimes g_warning, the g_error 
> > > is more correct pair for it.
> > > 
> > > Or we don't want any of g_error / g_warning in QEMU code?
> > 
> > g_error will call abort() after printing the message, which will
> > prevent graceful cleanup and result in a core file, so is not
> > very desirable to use.
> 
> Oh, right, I was stupid)
> 
> > 
> > g_warning will also turn into g_error if G_DEBUG=fatal-warnings
> > is set.
> > 
> > We really just want a plain message printed on the console with
> > no side effects, and g_printerr gives us that.
> > 
> > 
> 
> Still, it's strange for me, that we just not use error_reprot()/warn_report() 
> everywhere.

Those would be viable alternatives too. Basically anything is better
than 'g_warning' for this scenario :-)

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to