[gnome-online-accounts/gnome-3-8] alarm: Print warning if timerfd I/O fails



commit 8f8f8ccb8c81ecfb0c0e1be15020c2aa35ce9c00
Author: Ray Strode <rstrode redhat com>
Date:   Fri Sep 27 20:39:47 2013 -0400

    alarm: Print warning if timerfd I/O fails
    
    Reading from a timerfd shouldn't fail, but if it
    does we should print what's going on.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708975

 src/goaidentity/goaalarm.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
index 56ac054..05160af 100644
--- a/src/goaidentity/goaalarm.c
+++ b/src/goaidentity/goaalarm.c
@@ -364,6 +364,7 @@ on_timer_source_ready (GObject *stream, GoaAlarm *self)
   gint64 number_of_fires;
   gssize bytes_read;
   gboolean run_again = FALSE;
+  GError *error = NULL;
 
   g_return_val_if_fail (GOA_IS_ALARM (self), FALSE);
   g_return_val_if_fail (self->priv->type == GOA_ALARM_TYPE_TIMER, FALSE);
@@ -375,7 +376,15 @@ on_timer_source_ready (GObject *stream, GoaAlarm *self)
   bytes_read =
     g_pollable_input_stream_read_nonblocking (G_POLLABLE_INPUT_STREAM (stream),
                                               &number_of_fires, sizeof (gint64),
-                                              NULL, NULL);
+                                              NULL, &error);
+
+  if (bytes_read < 0)
+    {
+      goa_warning ("GoaAlarm: failed to read from timer fd: %s\n",
+                   error->message);
+      g_error_free (error);
+      goto out;
+    }
 
   if (bytes_read == sizeof (gint64))
     {


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