Skip to content

Commit

Permalink
[3.12] gh-123917: Fix crypt check in configure (#123952)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vstinner and madscientist authored Sep 12, 2024
1 parent 5c15b1a commit 53af5b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix the check for the ``crypt()`` function in the configure script. Patch by
Paul Smith and Victor Stinner.
6 changes: 4 additions & 2 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
])
Expand Down

0 comments on commit 53af5b2

Please sign in to comment.