[PATCH 11 of 12] Win32: fixed ngx_fs_bsize() for symlinks
Maxim Dounin
mdounin at mdounin.ru
Sun Feb 19 17:23:39 UTC 2023
Hello!
On Fri, Feb 17, 2023 at 07:17:02PM +0400, Sergey Kandaurov wrote:
> > On 13 Jan 2023, at 01:35, Maxim Dounin <mdounin at mdounin.ru> wrote:
> >
> > # HG changeset patch
> > # User Maxim Dounin <mdounin at mdounin.ru>
> > # Date 1673549010 -10800
> > # Thu Jan 12 21:43:30 2023 +0300
> > # Node ID be7eb9ec28dcbfdfd2e850befc8d051c0e4d46fd
> > # Parent e62c8e9724ba68a698a2c3613edca73fe4e1c4ae
> > Win32: fixed ngx_fs_bsize() for symlinks.
> >
> > 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 calling GetDiskFreeSpace() with just a drive letter, we now always
> > use GetDiskFreeSpace() with full path.
> >
> > diff -r e62c8e9724ba -r be7eb9ec28dc src/os/win32/ngx_files.c
> > --- a/src/os/win32/ngx_files.c Thu Jan 12 21:43:14 2023 +0300
> > +++ b/src/os/win32/ngx_files.c Thu Jan 12 21:43:30 2023 +0300
> > @@ -955,14 +955,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;
> > - }
> > -
>
> BTW, I wonder how this condition could be true.
> Specifically, what name should represent in order to match.
> I'm happy that it's leaving though.
I tend to think that this actually never worked, and the original
intention was to test name[1] instead.
Updated commit log:
: 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 ':'.
[...]
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list