Handle EINTR for a few more write() calls

https://bugzilla.gnome.org/show_bug.cgi?id=682819
This commit is contained in:
Colin Walters 2012-08-29 11:44:01 -04:00
parent 2ab5ed84b2
commit 090f874626
2 changed files with 15 additions and 3 deletions

View File

@ -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*

View File

@ -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));
}
}
/**