[gnome-online-accounts/gnome-3-28] alarm: Refresh Kerberos tickets after a suspended system is resumed



commit b66f4f8d3cd12794ef54714ab7fe9cf2fd21a344
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date:   Mon May 14 18:55:58 2018 +0200

    alarm: Refresh Kerberos tickets after a suspended system is resumed
    
    A read(2) from the timerfd will fail with ECANCELED [1], which will be
    seen as G_IO_ERROR_CANCELLED, when the clock jumps after waking up. In
    this case, instead of giving up, the alarm should continue to fire or
    re-arm as needed.
    
    [1] http://man7.org/linux/man-pages/man2/timerfd_create.2.html
    
    https://bugzilla.gnome.org/show_bug.cgi?id=796095

 src/goaidentity/goaalarm.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/goaidentity/goaalarm.c b/src/goaidentity/goaalarm.c
index 8720a025..9bdf85f2 100644
--- a/src/goaidentity/goaalarm.c
+++ b/src/goaidentity/goaalarm.c
@@ -281,10 +281,14 @@ on_timer_source_ready (GObject *stream, GoaAlarm *self)
 
   if (bytes_read < 0)
     {
-      g_warning ("GoaAlarm: failed to read from timer fd: %s\n",
-                 error->message);
-      g_error_free (error);
-      goto out;
+      if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+        g_debug ("GoaAlarm: discontinuity detected from timer fd");
+      else
+        {
+          g_warning ("GoaAlarm: failed to read from timer fd: %s\n",
+                     error->message);
+          goto out;
+        }
     }
 
   if (bytes_read == sizeof (gint64))
@@ -300,6 +304,7 @@ on_timer_source_ready (GObject *stream, GoaAlarm *self)
   run_again = TRUE;
 out:
   g_rec_mutex_unlock (&self->priv->lock);
+  g_clear_error (&error);
   return run_again;
 }
 #endif


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