Skip to content

bpo-35550 fix incorrect Solaris define guards #11275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix incorrect Solaris #ifdef checks to look for __sun && __SVR4 instead of sun when compiling.
2 changes: 1 addition & 1 deletion Modules/_posixsubprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# define SYS_getdents64 __NR_getdents64
#endif

#if defined(sun)
#if defined(__sun) && defined(__SVR4)
/* readdir64 is used to work around Solaris 9 bug 6395699. */
# define readdir readdir64
# define dirent dirent64
Expand Down
2 changes: 1 addition & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6334,7 +6334,7 @@ os_openpty_impl(PyObject *module)
#endif
#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY)
PyOS_sighandler_t sig_saved;
#ifdef sun
#if defined(__sun) && defined(__SVR4)
extern char *ptsname(int fildes);
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ if_indextoname(index) -- return the corresponding interface name\n\
#endif

/* Solaris fails to define this variable at all. */
#if defined(sun) && !defined(INET_ADDRSTRLEN)
#if (defined(__sun) && defined(__SVR4)) && !defined(INET_ADDRSTRLEN)
#define INET_ADDRSTRLEN 16
#endif

Expand Down
4 changes: 2 additions & 2 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ time_strftime(PyObject *self, PyObject *args)
return NULL;
}

#if defined(_MSC_VER) || defined(sun) || defined(_AIX)
#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX)
if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) {
PyErr_SetString(PyExc_ValueError,
"strftime() requires year in [1; 9999]");
Expand Down Expand Up @@ -789,7 +789,7 @@ time_strftime(PyObject *self, PyObject *args)
return NULL;
}
}
#elif (defined(_AIX) || defined(sun)) && defined(HAVE_WCSFTIME)
#elif (defined(_AIX) || (defined(__sun) && defined(__SVR4))) && defined(HAVE_WCSFTIME)
for (outbuf = wcschr(fmt, '%');
outbuf != NULL;
outbuf = wcschr(outbuf+2, '%'))
Expand Down
4 changes: 2 additions & 2 deletions Python/bootstrap_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int blocking, int raise)
flags = blocking ? 0 : GRND_NONBLOCK;
dest = buffer;
while (0 < size) {
#ifdef sun
#if defined(__sun) && defined(__SVR4)
/* Issue #26735: On Solaris, getrandom() is limited to returning up
to 1024 bytes. Call it multiple times if more bytes are
requested. */
Expand Down Expand Up @@ -264,7 +264,7 @@ py_getentropy(char *buffer, Py_ssize_t size, int raise)
}
return 1;
}
#endif /* defined(HAVE_GETENTROPY) && !defined(sun) */
#endif /* defined(HAVE_GETENTROPY) && !(defined(__sun) && defined(__SVR4)) */


static struct {
Expand Down