mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
[3.12] gh-123917: Fix crypt check in configure (#123952)
Use a global volatile variable and check if the function is not NULL to use the variable. Otherwise, a compiler optimization can remove the variable making the check useless. Co-authored-by: Paul Smith <paul@mad-scientist.net>
This commit is contained in:
parent
5c15b1a05a
commit
53af5b2dd2
3 changed files with 10 additions and 4 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Fix the check for the ``crypt()`` function in the configure script. Patch by
|
||||
Paul Smith and Victor Stinner.
|
||||
6
configure
generated
vendored
6
configure
generated
vendored
|
|
@ -22041,16 +22041,18 @@ else $as_nop
|
|||
#include <crypt.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
volatile void *func;
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
#ifdef HAVE_CRYPT_R
|
||||
void *x = crypt_r;
|
||||
func = crypt_r;
|
||||
#else
|
||||
void *x = crypt;
|
||||
func = crypt;
|
||||
#endif
|
||||
return (func != NULL);
|
||||
|
||||
;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -5237,12 +5237,14 @@ WITH_SAVE_ENV([
|
|||
#include <crypt.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
volatile void *func;
|
||||
], [
|
||||
#ifdef HAVE_CRYPT_R
|
||||
void *x = crypt_r;
|
||||
func = crypt_r;
|
||||
#else
|
||||
void *x = crypt;
|
||||
func = crypt;
|
||||
#endif
|
||||
return (func != NULL);
|
||||
])
|
||||
], [ac_cv_crypt_crypt=yes], [ac_cv_crypt_crypt=no])
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue