Too many level of symbolic links (still have problem with sbmfs network drives)

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Mar 14 09:49:22 GMT 2022


Hi Takashi,

On Mar 12 11:36, Takashi Yano wrote:
> The problem was that GetDosDeviceW() returns unexpected string such as
> "\Device\Mup\DfsClient\;Z:000000000003fb89\dfsserver\dfs\linkname"
> for the mounted UNC path:
> "\??\UNC\fileserver\share"
> 
> This happens when UNC path for DFS is mounted to a drive with drive letter.
> 
> Therefore, I would like to propose a workaround patch attached.
> I will appreciate any comments for the patch.

> -			goto file_not_symlink; /* fallback */
> -		      remlen -= 2;
> +			goto file_not_symlink; /* fallback (not expected) */

Why do you add this "not expected:?  It doesn't add any info, afaics,
and just makes the patch bigger.

> +		      remlen -= 2; /* Two L'\0' */
>  
>  		      if (remote[remlen - 1] == L'\\')
>  			remlen--;
> @@ -3535,20 +3535,26 @@ restart:
>  		      UNICODE_STRING rpath;
>  		      RtlInitCountedUnicodeString (&rpath, remote,
>  						   remlen * sizeof (WCHAR));
> +		      int uncp_len = wcslen (ro_u_uncp.Buffer) - 1;

You don't have to call wcslen, you already have the length in the
UNICODE_STRING.  I'd also constify this:

		      const USHORT uncp_len = ro_u_uncp.Length / sizeof (WCHAR)
					      - 1;

Other than that, looks good to me.


Thanks,
Corinna


More information about the Cygwin mailing list