[gnome-online-accounts/wip/rishi/kerberos-suspend] alarm: Refresh Kerberos tickets after a suspended system is resumed



commit 4e6ab7a4e029fae52ce8d9c44b90a5947d49194c
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 d2fadfc4..4531b30b 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 /*HAVE_TIMERFD */


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