[glib] open(2): POSIX compatibility.
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] open(2): POSIX compatibility.
- Date: Mon, 15 Aug 2011 07:54:29 +0000 (UTC)
commit 230efe70f418017e809e99710e0519f716edebe3
Author: Antoine Jacoutot <ajacoutot openbsd org>
Date: Sun Aug 14 01:23:36 2011 +0200
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 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/glib/giounix.c b/glib/giounix.c
index 5624ac9..969c3cc 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]