From 230efe70f418017e809e99710e0519f716edebe3 Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Sun, 14 Aug 2011 01:23:36 +0200 Subject: [PATCH] open(2): POSIX compatibility. Posix allows for open(2) to fail with errno = EINTR. Normal this isn't seen when opening files. However in some case we are opening a fifo for write which will block until another process opens it for read. If a signal is received while blocked, open(2) fails with errno = EINTR. https://bugzilla.gnome.org/show_bug.cgi?id=656492 --- glib/giounix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glib/giounix.c b/glib/giounix.c index 5624ac9d0..969c3cc59 100644 --- a/glib/giounix.c +++ b/glib/giounix.c @@ -524,7 +524,13 @@ g_io_channel_new_file (const gchar *filename, } create_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - fid = open (filename, flags, create_mode); + + do + { + fid = open (filename, flags, create_mode); + } + while (fid == -1 && errno == EINTR); + if (fid == -1) { int err = errno;