mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42: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>
|
#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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user