diff options
author | Kevin McCarthy <kevin@8t8.us> | 2016-04-27 13:08:52 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2016-04-27 13:08:52 -0700 |
commit | de228267466948e45cff1862684288398e9e9cc1 (patch) | |
tree | 540e6850aefe11e42afee92300ec8c31819ab766 | |
parent | 80e314f205d513f28fdf5bc07cce07b8661bc551 (diff) |
Create a wrapper sys_socket.h to work around Solaris namespace issues. (closes #3833)
Solaris includes "sys/stream.h" inside their "sys/socket.h". This
include file adds many non-reserved macros to Mutt's namespace, two of
which conflict with existing Mutt macros.
The simplest fix would be to rename those macros in Mutt, however this
will cause difficulty with out-of-tree patches. This fix creates a
wrapper include file that preserves those existing macros and prevents
the Solaris values from entering Mutt's namespace.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | getdomain.c | 2 | ||||
-rw-r--r-- | mutt_sasl.c | 2 | ||||
-rw-r--r-- | mutt_socket.c | 2 | ||||
-rw-r--r-- | mutt_tunnel.c | 2 | ||||
-rw-r--r-- | sys_socket.h | 51 |
6 files changed, 56 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index 9afb6ce7..9ee3faec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,7 +72,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \ README.SSL smime.h group.h \ muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ ChangeLog mkchangelog.sh mutt_idna.h \ - snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \ + snprintf.c regex.c crypt-gpgme.h hcachever.sh.in sys_socket.h \ txt2c.c txt2c.sh version.sh check_sec.sh EXTRA_SCRIPTS = smime_keys diff --git a/getdomain.c b/getdomain.c index 209848b7..9bc0c91e 100644 --- a/getdomain.c +++ b/getdomain.c @@ -24,7 +24,7 @@ #include <unistd.h> #include <netdb.h> #include <sys/types.h> -#include <sys/socket.h> +#include "sys_socket.h" #include "mutt.h" diff --git a/mutt_sasl.c b/mutt_sasl.c index d580c477..0a00c815 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -30,7 +30,7 @@ #include <errno.h> #include <netdb.h> #include <sasl/sasl.h> -#include <sys/socket.h> +#include "sys_socket.h" #include <netinet/in.h> static int getnameinfo_err(int ret) diff --git a/mutt_socket.c b/mutt_socket.c index 4708f9c4..6cfcc68c 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -40,7 +40,7 @@ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif -#include <sys/socket.h> +#include "sys_socket.h" #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif diff --git a/mutt_tunnel.c b/mutt_tunnel.c index b43bbf93..49172160 100644 --- a/mutt_tunnel.c +++ b/mutt_tunnel.c @@ -27,7 +27,7 @@ #include <netinet/in.h> #include <sys/types.h> -#include <sys/socket.h> +#include "sys_socket.h" #include <sys/wait.h> #include <fcntl.h> #include <errno.h> diff --git a/sys_socket.h b/sys_socket.h new file mode 100644 index 00000000..68ffe250 --- /dev/null +++ b/sys_socket.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2016 Kevin J. McCarthy <kevin@8t8.us> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Solaris, OpenIndiana, and probably other derivatives + * are including sys/stream.h inside their sys/socket.h. + * + * This include file is defining macros M_CMD and M_READ which + * are conflicting with the same macros Mutt defines in mutt.h + * + * To minimize breakage with out-of-tree patches, this is a workaround. + */ + +#ifdef M_CMD +# define MUTT_ORIG_CMD M_CMD +# undef M_CMD +#endif + +#ifdef M_READ +# define MUTT_ORIG_READ M_READ +# undef M_READ +#endif + +#include <sys/socket.h> + +#undef M_CMD +#undef M_READ + +#ifdef MUTT_ORIG_CMD +# define M_CMD MUTT_ORIG_CMD +# undef MUTT_ORIG_CMD +#endif + +#ifdef MUTT_ORIG_READ +# define M_READ MUTT_ORIG_READ +# undef MUTT_ORIG_READ +#endif |