From 090f874626312e83d053a51aeb59670b2a9655d7 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 29 Aug 2012 11:44:01 -0400 Subject: [PATCH] Handle EINTR for a few more write() calls https://bugzilla.gnome.org/show_bug.cgi?id=682819 --- glib/gmessages.c | 5 ++++- glib/gwakeup.c | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/glib/gmessages.c b/glib/gmessages.c index 91d7a21..d346eaf 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -281,7 +281,10 @@ static void write_string (int fd, const gchar *string) { - write (fd, string, strlen (string)); + int res; + do + res = write (fd, string, strlen (string)); + while (G_UNLIKELY (res == -1 && errno == EINTR)); } static GLogDomain* diff --git a/glib/gwakeup.c b/glib/gwakeup.c index bb49059..ad92d56 100644 --- a/glib/gwakeup.c +++ b/glib/gwakeup.c @@ -230,11 +230,20 @@ void g_wakeup_signal (GWakeup *wakeup) { guint64 one = 1; + int res; if (wakeup->fds[1] == -1) - write (wakeup->fds[0], &one, sizeof one); + { + do + res = write (wakeup->fds[0], &one, sizeof one); + while (G_UNLIKELY (res == -1 && errno == EINTR)); + } else - write (wakeup->fds[1], &one, 1); + { + do + write (wakeup->fds[1], &one, 1); + while (G_UNLIKELY (res == -1 && errno == EINTR)); + } } /** -- 2.7.4