summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-12-12 07:38:04 +0000
committerAntony Dovgal <tony2001@php.net>2006-12-12 07:38:04 +0000
commita74c36a33506424ced2861ba0837a0a64546e0e6 (patch)
treedfefdf1e31449093a23ec1ba82623e6c3b4314ca /ext
parent2f291233e6458822143754867cd15092de2f984e (diff)
downloadphp-git-a74c36a33506424ced2861ba0837a0a64546e0e6.tar.gz
MFH: fix #39795 (build fails on AIX because crypt_r() uses different data struct)
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/crypt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 1e138c775f..e139554d6d 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -28,6 +28,9 @@
#include <unistd.h>
#endif
#if HAVE_CRYPT_H
+#if defined(CRYPT_R_GNU_SOURCE) && !defined(_GNU_SOURCE)
+#define _GNU_SOURCE
+#endif
#include <crypt.h>
#endif
#if TM_IN_SYS_TIME
@@ -147,8 +150,15 @@ PHP_FUNCTION(crypt)
}
#ifdef HAVE_CRYPT_R
{
+#if defined(CRYPT_R_STRUCT_CRYPT_DATA)
struct crypt_data buffer;
memset(&buffer, 0, sizeof(buffer));
+#elif defined(CRYPT_R_CRYPTD)
+ CRYPTD buffer;
+#else
+#error Data struct used by crypt_r() is unknown. Please report.
+#endif
+
RETURN_STRING(crypt_r(str, salt, &buffer), 1);
}
#else