summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2013-09-10 22:34:07 +0800
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-13 13:36:32 +0100
commitc1288c5366f64b45280b4f8865e2efb716663ccd (patch)
treef2e322a54fd8515b4d48f155522d85b572f366ee
parent7a53684d422d10d5e89ff0dee7f3c7539de11341 (diff)
downloaddbus-c1288c5366f64b45280b4f8865e2efb716663ccd.tar.gz
Allow EPROTOTYPE for SOCK_CLOEXEC but unsupported by socket/socketpair
If SOCK_CLOEXEC is defined (usually because accept4 is implemented), check for EPROTOTYPE (the POSIX errno for invalid socket types) in addition to EINVAL as errno indicating whether socket and socketpair do not support SOCK_CLOEXEC (and other SOCK_* flags). [adapted by Chengwei Yang to give _dbus_connect_exec() the same treatment] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69073 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r--dbus/dbus-sysdeps-unix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index b84ad0e9..8405a429 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -139,7 +139,7 @@ _dbus_open_socket (int *fd_p,
cloexec_done = *fd_p >= 0;
/* Check if kernel seems to be too old to know SOCK_CLOEXEC */
- if (*fd_p < 0 && errno == EINVAL)
+ if (*fd_p < 0 && (errno == EINVAL || errno == EPROTOTYPE))
#endif
{
*fd_p = socket (domain, type, protocol);
@@ -898,7 +898,7 @@ _dbus_connect_exec (const char *path,
retval = socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds);
cloexec_done = (retval >= 0);
- if (retval < 0 && (errno == EINVAL))
+ if (retval < 0 && (errno == EINVAL || errno == EPROTOTYPE))
#endif
{
retval = socketpair (AF_UNIX, SOCK_STREAM, 0, fds);
@@ -3066,7 +3066,7 @@ _dbus_full_duplex_pipe (int *fd1,
retval = socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds);
cloexec_done = retval >= 0;
- if (retval < 0 && errno == EINVAL)
+ if (retval < 0 && (errno == EINVAL || errno == EPROTOTYPE))
#endif
{
retval = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);