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



commit cdc049af46e5e50aea408b64f30007cd3a467efa
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 e9b904b..4b9d086 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]