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
This commit is contained in:
Colin Walters 2012-08-27 14:37:21 -04:00
parent d54e10632a
commit ce976bcac7

View File

@ -40,6 +40,7 @@
#include <sys/utime.h> #include <sys/utime.h>
#else #else
#include <utime.h> #include <utime.h>
#include <errno.h>
#endif #endif
#include "gstdio.h" #include "gstdio.h"
@ -209,7 +210,11 @@ g_open (const gchar *filename,
errno = save_errno; errno = save_errno;
return retval; return retval;
#else #else
return open (filename, flags, mode); int fd;
do
fd = open (filename, flags, mode);
while (G_UNLIKELY (fd == -1 && errno == EINTR));
return fd;
#endif #endif
} }