[nginx] Win32: removed attempt to use a drive letter in ngx_fs_bsize().

Sergey Kandaurov pluknet at nginx.com
Fri Feb 24 10:33:16 UTC 2023


details:   https://hg.nginx.org/nginx/rev/c33eb93f9c7a
branches:  
changeset: 8140:c33eb93f9c7a
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Thu Feb 23 20:50:00 2023 +0300
description:
Win32: removed attempt to use a drive letter in ngx_fs_bsize().

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 ':'.

diffstat:

 src/os/win32/ngx_files.c |  6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diffs (18 lines):

diff -r e818ed227735 -r c33eb93f9c7a src/os/win32/ngx_files.c
--- a/src/os/win32/ngx_files.c	Thu Feb 23 20:49:57 2023 +0300
+++ b/src/os/win32/ngx_files.c	Thu Feb 23 20:50:00 2023 +0300
@@ -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;
     }


More information about the nginx-devel mailing list