summaryrefslogtreecommitdiffstats
path: root/Modules/_cryptmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_cryptmodule.c')
-rw-r--r--Modules/_cryptmodule.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
index 58d179e..5d03f45 100644
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -34,7 +34,15 @@ static PyObject *
crypt_crypt_impl(PyObject *module, const char *word, const char *salt)
/*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/
{
- return Py_BuildValue("s", crypt(word, salt));
+ char *crypt_result;
+#ifdef HAVE_CRYPT_R
+ struct crypt_data data;
+ memset(&data, 0, sizeof(data));
+ crypt_result = crypt_r(word, salt, &data);
+#else
+ crypt_result = crypt(word, salt);
+#endif
+ return Py_BuildValue("s", crypt_result);
}