]> git.kaiwu.me - nginx.git/commitdiff
Win32: removed attempt to use a drive letter in ngx_fs_bsize().
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 23 Feb 2023 17:50:00 +0000 (20:50 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 23 Feb 2023 17:50:00 +0000 (20:50 +0300)
Just a drive letter might not correctly represent file system being used,
notably when using symlinks (as created by "mklink /d").  As such, instead
of trying to call GetDiskFreeSpace() with just a drive letter, we now always
use GetDiskFreeSpace() with full path.

Further, it looks like the code to use just a drive letter never worked,
since it tried to test name[2] instead of name[1] to be ':'.

src/os/win32/ngx_files.c

index 6f57a17756c22301d97a57de764f6686251f26fb..3e0037859fc0c7bac32e18f2822fde552c844703 100644 (file)
@@ -967,14 +967,8 @@ ngx_directio_off(ngx_fd_t fd)
 size_t
 ngx_fs_bsize(u_char *name)
 {
-    u_char  root[4];
     u_long  sc, bs, nfree, ncl;
 
-    if (name[2] == ':') {
-        ngx_cpystrn(root, name, 4);
-        name = root;
-    }
-
     if (GetDiskFreeSpace((const char *) name, &sc, &bs, &nfree, &ncl) == 0) {
         return 512;
     }