summaryrefslogtreecommitdiff
path: root/ext/opcache/shared_alloc_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache/shared_alloc_win32.c')
-rw-r--r--ext/opcache/shared_alloc_win32.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c
index c71f253b0a..3b08db6959 100644
--- a/ext/opcache/shared_alloc_win32.c
+++ b/ext/opcache/shared_alloc_win32.c
@@ -77,25 +77,35 @@ static void zend_win_error_message(int type, char *msg, int err)
static char *create_name_with_username(char *name)
{
static char newname[MAXPATHLEN + UNLEN + 4 + 1 + 32];
- char uname[UNLEN + 1];
- DWORD unsize = UNLEN;
+ char *uname;
- GetUserName(uname, &unsize);
+ uname = php_win32_get_username();
+ if (!uname) {
+ return NULL;
+ }
snprintf(newname, sizeof(newname) - 1, "%s@%s@%.32s", name, uname, ZCG(system_id));
+
+ free(uname);
+
return newname;
}
static char *get_mmap_base_file(void)
{
static char windir[MAXPATHLEN+UNLEN + 3 + sizeof("\\\\@") + 1 + 32];
- char uname[UNLEN + 1];
- DWORD unsize = UNLEN;
+ char *uname;
int l;
+ uname = php_win32_get_username();
+ if (!uname) {
+ return NULL;
+ }
GetTempPath(MAXPATHLEN, windir);
- GetUserName(uname, &unsize);
l = strlen(windir);
snprintf(windir + l, sizeof(windir) - l - 1, "\\%s@%s@%.32s", ACCEL_FILEMAP_BASE, uname, ZCG(system_id));
+
+ free(uname);
+
return windir;
}