mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
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:
parent
d54e10632a
commit
ce976bcac7
@ -40,6 +40,7 @@
|
||||
#include <sys/utime.h>
|
||||
#else
|
||||
#include <utime.h>
|
||||
#include <errno.h>
|
||||
#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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user