From 2d7102e726e973ab2d307aa9748c7ec433677877 Mon Sep 17 00:00:00 2001 From: Thomas Herzog Date: Sun, 2 Sep 2018 00:13:57 +0200 Subject: [PATCH] closes bpo-34555: Fix incorrectly nested test for HAVE_LINUX_VM_SOCKETS_H (GH-9016) --- .../2018-08-31-19-41-09.bpo-34555.dfQcnm.rst | 2 + Modules/socketmodule.h | 53 ++++++++++--------- 2 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2018-08-31-19-41-09.bpo-34555.dfQcnm.rst diff --git a/Misc/NEWS.d/next/Build/2018-08-31-19-41-09.bpo-34555.dfQcnm.rst b/Misc/NEWS.d/next/Build/2018-08-31-19-41-09.bpo-34555.dfQcnm.rst new file mode 100644 index 00000000000..7e61c4fb20a --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-08-31-19-41-09.bpo-34555.dfQcnm.rst @@ -0,0 +1,2 @@ +Fix for case where it was not possible to have both +``HAVE_LINUX_VM_SOCKETS_H`` and ``HAVE_SOCKADDR_ALG`` be undefined. diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index bce74c3da8f..0b2edc15878 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -101,39 +101,40 @@ typedef int socklen_t; #include #endif -#ifdef HAVE_SOCKADDR_ALG -#include -#ifndef AF_ALG -#define AF_ALG 38 -#endif -#ifndef SOL_ALG -#define SOL_ALG 279 -#endif - #ifdef HAVE_LINUX_VM_SOCKETS_H # include #else # undef AF_VSOCK #endif -/* Linux 3.19 */ -#ifndef ALG_SET_AEAD_ASSOCLEN -#define ALG_SET_AEAD_ASSOCLEN 4 -#endif -#ifndef ALG_SET_AEAD_AUTHSIZE -#define ALG_SET_AEAD_AUTHSIZE 5 -#endif -/* Linux 4.8 */ -#ifndef ALG_SET_PUBKEY -#define ALG_SET_PUBKEY 6 -#endif +#ifdef HAVE_SOCKADDR_ALG -#ifndef ALG_OP_SIGN -#define ALG_OP_SIGN 2 -#endif -#ifndef ALG_OP_VERIFY -#define ALG_OP_VERIFY 3 -#endif +# include +# ifndef AF_ALG +# define AF_ALG 38 +# endif +# ifndef SOL_ALG +# define SOL_ALG 279 +# endif + +/* Linux 3.19 */ +# ifndef ALG_SET_AEAD_ASSOCLEN +# define ALG_SET_AEAD_ASSOCLEN 4 +# endif +# ifndef ALG_SET_AEAD_AUTHSIZE +# define ALG_SET_AEAD_AUTHSIZE 5 +# endif +/* Linux 4.8 */ +# ifndef ALG_SET_PUBKEY +# define ALG_SET_PUBKEY 6 +# endif + +# ifndef ALG_OP_SIGN +# define ALG_OP_SIGN 2 +# endif +# ifndef ALG_OP_VERIFY +# define ALG_OP_VERIFY 3 +# endif #endif /* HAVE_SOCKADDR_ALG */