summaryrefslogtreecommitdiff
path: root/ext/standard/crypt.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-30 16:00:05 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-30 16:00:05 +0000
commit053747b5129810d60ae7b0e45af8655384cd02ca (patch)
tree33a8d61c258f532448b6f6eadab59a804cc7bbb2 /ext/standard/crypt.c
parent55ebcb9f7e5caa31d22fc98b43312e817c33bad9 (diff)
downloadphp-git-053747b5129810d60ae7b0e45af8655384cd02ca.tar.gz
MFB: Use reantrant crypt_r() whenever possible.
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r--ext/standard/crypt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 7d1eea0b76..97ff2fc04d 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -145,8 +145,15 @@ PHP_FUNCTION(crypt)
salt[2] = '\0';
#endif
}
-
- RETVAL_STRING(crypt(str, salt), 1);
+#ifdef HAVE_CRYPT_R
+ {
+ struct crypt_data buffer;
+ memset(&buffer, 0, sizeof(buffer));
+ RETURN_STRING(crypt_r(str, salt, &buffer));
+ }
+#else
+ RETURN_STRING(crypt(str, salt), 1);
+#endif
}
/* }}} */
#endif