Skip to content

Commit 53af5b2

Browse files
[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 <[email protected]>
1 parent 5c15b1a commit 53af5b2

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the check for the ``crypt()`` function in the configure script. Patch by
2+
Paul Smith and Victor Stinner.

configure

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5237,12 +5237,14 @@ WITH_SAVE_ENV([
52375237
#include <crypt.h>
52385238
#endif
52395239
#include <unistd.h>
5240+
volatile void *func;
52405241
], [
52415242
#ifdef HAVE_CRYPT_R
5242-
void *x = crypt_r;
5243+
func = crypt_r;
52435244
#else
5244-
void *x = crypt;
5245+
func = crypt;
52455246
#endif
5247+
return (func != NULL);
52465248
])
52475249
], [ac_cv_crypt_crypt=yes], [ac_cv_crypt_crypt=no])
52485250
])

0 commit comments

Comments
 (0)