SO_PROTOCOL is platform-dependent
authorJakub Hrozek <jakub.hrozek@gmail.com>
Thu, 2 Oct 2014 05:04:15 +0000 (07:04 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 2 Oct 2014 07:35:10 +0000 (09:35 +0200)
SO_PROTOCOL is not defined on all platforms. In particular, OSX doesn't
include it and so far I haven't found any compatible declaration.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/socket_wrapper/socket_wrapper.c

index 7ee5b6410658dd03c27dc70c0ecbb8e3fffe6426..903eec21537429fc69ea4979094888cf71c244a0 100644 (file)
@@ -3169,6 +3169,8 @@ static int swrap_getsockopt(int s, int level, int optname,
                        *(int *)optval = si->family;
                        return 0;
 #endif /* SO_DOMAIN */
+
+#ifdef SO_PROTOCOL
                case SO_PROTOCOL:
                        if (optval == NULL || optlen == NULL ||
                            *optlen < (socklen_t)sizeof(int)) {
@@ -3179,6 +3181,7 @@ static int swrap_getsockopt(int s, int level, int optname,
                        *optlen = sizeof(int);
                        *(int *)optval = si->protocol;
                        return 0;
+#endif /* SO_PROTOCOL */
                case SO_TYPE:
                        if (optval == NULL || optlen == NULL ||
                            *optlen < (socklen_t)sizeof(int)) {