Windows: Remove trailing slash on non-root directories
[openafs.git] / src / WINNT / afsrdr / kernel / lib / AFSNameSupport.cpp
index 97cdb0c..6448ded 100644 (file)
@@ -5263,7 +5263,6 @@ AFSGetFullFileName( IN AFSFcb *Fcb,
     ULONG       ulCopyLength = 0;
     ULONG       cchCopied = 0;
     BOOLEAN     bAddTrailingSlash = FALSE;
-    BOOLEAN     bAddLeadingSlash = FALSE;
     USHORT      usFullNameLength = 0;
 
     __Enter
@@ -5273,15 +5272,11 @@ AFSGetFullFileName( IN AFSFcb *Fcb,
        // Add a trailing slash for anything which is of the form \server\share
        //
 
-       if( Ccb->FullFileName.Length == 0 ||
-           Ccb->FullFileName.Buffer[ 0] != L'\\')
-       {
-           bAddLeadingSlash = TRUE;
-       }
-
-       if( Fcb->ObjectInformation->FileType == AFS_FILE_TYPE_DIRECTORY &&
-           Ccb->FullFileName.Length > 0 &&
-           Ccb->FullFileName.Buffer[ (Ccb->FullFileName.Length/sizeof( WCHAR)) - 1] != L'\\')
+       if( ( Fcb->ObjectInformation->FileType == AFS_FILE_TYPE_DIRECTORY ||
+             Fcb->ObjectInformation->FileType == AFS_FILE_TYPE_MOUNTPOINT) &&
+           Ccb->FullFileName.Length > sizeof( WCHAR) &&
+           Ccb->FullFileName.Buffer[ (Ccb->FullFileName.Length/sizeof( WCHAR)) - 1] != L'\\' &&
+           AFSIsShareName( &Ccb->FullFileName))
        {
            bAddTrailingSlash = TRUE;
        }
@@ -5290,11 +5285,6 @@ AFSGetFullFileName( IN AFSFcb *Fcb,
                                    AFSServerName.Length +
                                    Ccb->FullFileName.Length;
 
-       if( bAddLeadingSlash)
-       {
-           usFullNameLength += sizeof( WCHAR);
-       }
-
        if( bAddTrailingSlash)
        {
            usFullNameLength += sizeof( WCHAR);
@@ -5334,17 +5324,6 @@ AFSGetFullFileName( IN AFSFcb *Fcb,
                *RemainingLength -= AFSServerName.Length;
                cchCopied += AFSServerName.Length/sizeof( WCHAR);
 
-               if ( ulCopyLength > 0 &&
-                    bAddLeadingSlash)
-               {
-
-                   FileName[ cchCopied] = L'\\';
-
-                   ulCopyLength -= sizeof( WCHAR);
-                   *RemainingLength -= sizeof( WCHAR);
-                   cchCopied++;
-               }
-
                if( ulCopyLength >= Ccb->FullFileName.Length)
                {