From ce976bcac7294e72b3e94dda17fe5dfb157770d4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 27 Aug 2012 14:37:21 -0400 Subject: [PATCH] gstdio: Harden g_open() against EINTR Noticed by code inspection, when auditing some of my code for EINTR handling. https://bugzilla.gnome.org/show_bug.cgi?id=682819 --- glib/gstdio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/glib/gstdio.c b/glib/gstdio.c index 6d763e1f6..71431f1fe 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -40,6 +40,7 @@ #include #else #include +#include #endif #include "gstdio.h" @@ -209,7 +210,11 @@ g_open (const gchar *filename, errno = save_errno; return retval; #else - return open (filename, flags, mode); + int fd; + do + fd = open (filename, flags, mode); + while (G_UNLIKELY (fd == -1 && errno == EINTR)); + return fd; #endif }