mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-35550: Fix incorrect Solaris define guards (GH-11275)
Python source code uses on several places ifdef sun or defined(sun) without the underscores, which is not standard compliant and shouldn't be used. Defines should check for __sun instead. Reference: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#Solaris https://bugs.python.org/issue35550
This commit is contained in:
parent
30e023256a
commit
6f9bc72c79
6 changed files with 8 additions and 7 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix incorrect Solaris #ifdef checks to look for __sun && __SVR4 instead of sun when compiling.
|
|
@ -30,7 +30,7 @@
|
||||||
# define SYS_getdents64 __NR_getdents64
|
# define SYS_getdents64 __NR_getdents64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(sun)
|
#if defined(__sun) && defined(__SVR4)
|
||||||
/* readdir64 is used to work around Solaris 9 bug 6395699. */
|
/* readdir64 is used to work around Solaris 9 bug 6395699. */
|
||||||
# define readdir readdir64
|
# define readdir readdir64
|
||||||
# define dirent dirent64
|
# define dirent dirent64
|
||||||
|
|
|
@ -6335,7 +6335,7 @@ os_openpty_impl(PyObject *module)
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY)
|
#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY)
|
||||||
PyOS_sighandler_t sig_saved;
|
PyOS_sighandler_t sig_saved;
|
||||||
#ifdef sun
|
#if defined(__sun) && defined(__SVR4)
|
||||||
extern char *ptsname(int fildes);
|
extern char *ptsname(int fildes);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -267,7 +267,7 @@ http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Solaris fails to define this variable at all. */
|
/* 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
|
#define INET_ADDRSTRLEN 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,7 @@ time_strftime(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
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) {
|
if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"strftime() requires year in [1; 9999]");
|
"strftime() requires year in [1; 9999]");
|
||||||
|
@ -801,7 +801,7 @@ time_strftime(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif (defined(_AIX) || defined(sun)) && defined(HAVE_WCSFTIME)
|
#elif (defined(_AIX) || (defined(__sun) && defined(__SVR4))) && defined(HAVE_WCSFTIME)
|
||||||
for (outbuf = wcschr(fmt, '%');
|
for (outbuf = wcschr(fmt, '%');
|
||||||
outbuf != NULL;
|
outbuf != NULL;
|
||||||
outbuf = wcschr(outbuf+2, '%'))
|
outbuf = wcschr(outbuf+2, '%'))
|
||||||
|
|
|
@ -114,7 +114,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int blocking, int raise)
|
||||||
flags = blocking ? 0 : GRND_NONBLOCK;
|
flags = blocking ? 0 : GRND_NONBLOCK;
|
||||||
dest = buffer;
|
dest = buffer;
|
||||||
while (0 < size) {
|
while (0 < size) {
|
||||||
#ifdef sun
|
#if defined(__sun) && defined(__SVR4)
|
||||||
/* Issue #26735: On Solaris, getrandom() is limited to returning up
|
/* Issue #26735: On Solaris, getrandom() is limited to returning up
|
||||||
to 1024 bytes. Call it multiple times if more bytes are
|
to 1024 bytes. Call it multiple times if more bytes are
|
||||||
requested. */
|
requested. */
|
||||||
|
@ -264,7 +264,7 @@ py_getentropy(char *buffer, Py_ssize_t size, int raise)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif /* defined(HAVE_GETENTROPY) && !defined(sun) */
|
#endif /* defined(HAVE_GETENTROPY) && !(defined(__sun) && defined(__SVR4)) */
|
||||||
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue