mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-23 05:50:41 +02:00
gio: don't assume that SOCK_CLOEXEC is supported whenever it's defined
Just because SOCK_CLOEXEC was defined at build time doesn't mean the kernel we're running on supports it. So if socket() fails with EINVAL, try again without the flag. https://bugzilla.gnome.org/show_bug.cgi?id=624463
This commit is contained in:
parent
8a2d157d49
commit
732ff1b27c
@ -455,7 +455,9 @@ g_socket_create_socket (GSocketFamily family,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SOCK_CLOEXEC
|
#ifdef SOCK_CLOEXEC
|
||||||
native_type |= SOCK_CLOEXEC;
|
fd = socket (family, native_type | SOCK_CLOEXEC, protocol);
|
||||||
|
/* It's possible that libc has SOCK_CLOEXEC but the kernel does not */
|
||||||
|
if (fd < 0 && errno == EINVAL)
|
||||||
#endif
|
#endif
|
||||||
fd = socket (family, native_type, protocol);
|
fd = socket (family, native_type, protocol);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user