]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0' into PHP-7.1
authorAnatol Belski <ab@php.net>
Fri, 13 Jan 2017 15:54:10 +0000 (16:54 +0100)
committerAnatol Belski <ab@php.net>
Fri, 13 Jan 2017 15:54:10 +0000 (16:54 +0100)
* PHP-7.0:
  ensure the end path wouldn't contain double slashes

1  2 
ext/opcache/shared_alloc_win32.c

index 7532fe1688f8b3e4172cf5b4009e860b5f4befb2,d05f01cd2b274fbebbf44a1e1cc06580f4dda553..0cf65cf90ab9e0a50c247f37752b04ef6ddb45a8
@@@ -93,19 -88,17 +93,22 @@@ static char *create_name_with_username(
  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;
  }