* PHP-7.0:
ensure the end path wouldn't contain double slashes
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);
+ if ('\\' == windir[l-1]) {
+ l--;
+ }
snprintf(windir + l, sizeof(windir) - l - 1, "\\%s@%s@%.32s", ACCEL_FILEMAP_BASE, uname, ZCG(system_id));
+
+ free(uname);
+
return windir;
}