]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-windows-pioctl-20050902
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 2 Sep 2005 18:28:36 +0000 (18:28 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 2 Sep 2005 18:28:36 +0000 (18:28 +0000)
support '/' as well as '\\' in pioctl calls

(cherry picked from commit d04a62e64141903d17dd244e10094fd446ab73a7)

src/sys/pioctl_nt.c

index 74ab76279ea5f0b8b3df47761304d15316a63674..b4a5590055c8eefe7480129af959ae65cd895a97 100644 (file)
@@ -322,14 +322,16 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
             tbuffer[1] = ':';
             strcpy(tbuffer + 2, SMB_IOCTL_FILENAME);
         } else if (fileNamep[0] == fileNamep[1] && 
-                              fileNamep[0] == '\\')
+                  (fileNamep[0] == '\\' || fileNamep[0] == '/'))
         {
             int count = 0, i = 0;
 
             while (count < 4 && fileNamep[i]) {
                 tbuffer[i] = fileNamep[i];
-                if ( tbuffer[i++] == '\\' )
+                if ( tbuffer[i] == '\\' ||
+                    tbuffer[i] == '/')
                     count++;
+               i++;
             }
             if (fileNamep[i] == 0)
                 tbuffer[i++] = '\\';
@@ -344,14 +346,16 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                 tbuffer[1] = ':';
                 strcpy(tbuffer + 2, SMB_IOCTL_FILENAME);
             } else if (curdir[0] == curdir[1] &&
-                       curdir[0] == '\\'
+                       (curdir[0] == '\\' || curdir[0] == '/')
             {
                 int count = 0, i = 0;
 
                 while (count < 4 && curdir[i]) {
                     tbuffer[i] = curdir[i];
-                    if ( tbuffer[i++] == '\\' )
-                        count++;
+                   if ( tbuffer[i] == '\\' ||
+                        tbuffer[i] == '/')
+                       count++;
+                   i++;
                 }
                 if (tbuffer[i] == 0)
                     tbuffer[i++] = '\\';
@@ -691,6 +695,7 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize)
     int pathHasDrive;
     int doSwitch;
     char newPath[3];
+    char *p;
 
     if (pathp[0] != 0 && pathp[1] == ':') {
        /* there's a drive letter there */
@@ -701,7 +706,8 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize)
        pathHasDrive = 0;
     }
 
-    if ( firstp[0] == '\\' && firstp[1] == '\\') {
+    if ( firstp[0] == '\\' && firstp[1] == '\\' || 
+        firstp[0] == '/' && firstp[1] == '/') {
         /* UNC path - strip off the server and sharename */
         int i, count;
         for ( i=2,count=2; count < 4 && firstp[i]; i++ ) {
@@ -714,10 +720,18 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize)
         } else {
             strcpy(outPathp,&firstp[--i]);
         }
+       for (p=outPathp ;*p; p++) {
+           if (*p == '/')
+               *p = '\\';
+       }
         return 0;
     } else if (firstp[0] == '\\' || firstp[0] == '/') {
         /* already an absolute pathname, just copy it back */
         strcpy(outPathp, firstp);
+       for (p=outPathp ;*p; p++) {
+           if (*p == '/')
+               *p = '\\';
+       }
         return 0;
     }
 
@@ -747,7 +761,8 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize)
     GetCurrentDirectory(sizeof(tpath), tpath);
     if (tpath[1] == ':')
         strcpy(outPathp, tpath + 2);   /* skip drive letter */
-    else if ( tpath[0] == '\\' && tpath[1] == '\\') {
+    else if ( tpath[0] == '\\' && tpath[1] == '\\'||
+             tpath[0] == '/' && tpath[1] == '/') {
         /* UNC path - strip off the server and sharename */
         int i, count;
         for ( i=2,count=2; count < 4 && tpath[i]; i++ ) {
@@ -778,6 +793,10 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize)
        SetCurrentDirectory(origPath);
     }
 
+    for (p=outPathp ;*p; p++) {
+       if (*p == '/')
+           *p = '\\';
+    }
     return 0;
 }