Re: [spice-gtk v2 1/3] usb-device-manager: handle failures from g_udev_client_new()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, Nov 15, 2016 at 10:42:26AM -0600, Jonathon Jongsma wrote:
> On Tue, 2016-11-15 at 17:20 +0100, Christophe Fergeau wrote:
> > On Tue, Nov 15, 2016 at 02:33:14PM +0100, Victor Toso wrote:
> > > 
> > > From: Victor Toso <me@xxxxxxxxxxxxxx>
> > > 
> > > As we must handle when GUdevClient creation can fails otherwise
> > > code
> > > might crash.
> > > 
> > > Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
> > > Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> > > ---
> > >  src/usb-device-manager.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> > > index 3d4bd98..671a5be 100644
> > > --- a/src/usb-device-manager.c
> > > +++ b/src/usb-device-manager.c
> > > @@ -321,6 +321,11 @@ static gboolean
> > > spice_usb_device_manager_initable_init(GInitable  *initable,
> > >      /* Start listening for usb devices plug / unplug */
> > >  #ifdef USE_GUDEV
> > >      priv->udev = g_udev_client_new(subsystems, err);
> > > +    if (priv->udev == NULL) {
> > > +        const gchar *msg = (err != NULL && *err != NULL) ? (*err)-
> > > >message : "";
> > > +        g_warning("Error initializing GUdevClient due %s", msg);
> > > +        return FALSE;
> > > +    }
> > 
> > A (imo more readable) variant on that would be:
> > 
> > GError *local_error = NULL;
> > priv->udev  = g_udev_client_new(subsystems, &local_error)
> > if (priv->udev == NULL) {
> >     g_warning("Error: %s", local_error->message);
> >     g_propagate_error(err, local_error);
> >     return FALSE;
> > }
> > 
> > Your version:
> > Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
> 
> Nitpick:
> If you do use your original version (and you haven't already pushed
> yet), note that it should be "due to %s", not "due %s".

Yay :)

As per teuf's comment in the other patch, I changed the 'due' to '-'
I hope that's fine? (did not push it yet)
> 
> 
> 
> > 
> > > 
> > >      g_signal_connect(G_OBJECT(priv->udev), "uevent",
> > >                       G_CALLBACK(spice_usb_device_manager_uevent_cb
> > > ), self);
> > >      /* Do coldplug (detection of already connected devices) */
> > > -- 
> > > 2.9.3
> > > 
> > > _______________________________________________
> > > Spice-devel mailing list
> > > Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> > > https://lists.freedesktop.org/mailman/listinfo/spice-devel
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]