Commit 8b79efe7 authored by Jan Alexander Steffens (heftig)'s avatar Jan Alexander Steffens (heftig) Committed by Debarshi Ray

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
parent 2bc35ff2
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment