summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/pwd_grp/pwd_grp_internal.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libc/pwd_grp/pwd_grp_internal.c b/libc/pwd_grp/pwd_grp_internal.c
index 104f532e4..f82c298d5 100644
--- a/libc/pwd_grp/pwd_grp_internal.c
+++ b/libc/pwd_grp/pwd_grp_internal.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <stddef.h>
#include <errno.h>
+#include <malloc.h>
#include <assert.h>
#include <ctype.h>
#include <pwd.h>
@@ -92,14 +93,17 @@ libc_hidden_def(GETXXKEY_R_FUNC)
GETXXKEY_ENTTYPE *GETXXKEY_FUNC(GETXXKEY_ADD_PARAMS)
{
- static char buffer[GETXXKEY_BUFLEN];
+ static char *buffer = NULL;
static GETXXKEY_ENTTYPE resultbuf;
GETXXKEY_ENTTYPE *result;
+ if (buffer == NULL)
+ buffer = (char *)__uc_malloc(GETXXKEY_BUFLEN);
+
# ifdef GETXXKEY_ADD_VARIABLES
- REENTRANT_NAME(GETXXKEY_ADD_VARIABLES, &resultbuf, buffer, sizeof(buffer), &result);
+ REENTRANT_NAME(GETXXKEY_ADD_VARIABLES, &resultbuf, buffer, GETXXKEY_BUFLEN, &result);
# else
- REENTRANT_NAME(&resultbuf, buffer, sizeof(buffer), &result);
+ REENTRANT_NAME(&resultbuf, buffer, GETXXKEY_BUFLEN, &result);
# endif
return result;
}