windows handle NONODE case uniformly in cm_BPlusDirDeleteEntry
authormatt@linuxbox.com <matt@linuxbox.com>
Tue, 25 May 2010 00:26:46 +0000 (20:26 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Tue, 25 May 2010 19:42:37 +0000 (12:42 -0700)
Fix handling of a NONODE case in cm_BPlusDirDeleteEntry.  Previously in
this case, the routine referenced uninitialized memory.

Change-Id: Ic3e3520b4c28ccc52e04486777bdcf0c5e54ef1f
Change-Id: Id57a72112caf55b4b84ed64f709b8b73c72b7866
Reviewed-on: http://gerrit.openafs.org/2017
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_btree.c

index 7337934..a9329a4 100644 (file)
@@ -1901,20 +1901,19 @@ int  cm_BPlusDirDeleteEntry(cm_dirOp_t * op, clientchar_t *centry)
                     rc = CM_ERROR_INEXACT_MATCH;
                 } else {
                     rc = CM_ERROR_AMBIGUOUS_FILENAME;
-                } 
-            }
-
+                }
 
-            if (rc != CM_ERROR_AMBIGUOUS_FILENAME) {
-                dfid.vnode = htonl(fid.vnode);
-                dfid.unique = htonl(fid.unique);
-                cm_Gen8Dot3NameIntW(centry, &dfid, shortName, NULL);
+                if (rc != CM_ERROR_AMBIGUOUS_FILENAME) {
+                    dfid.vnode = htonl(fid.vnode);
+                    dfid.unique = htonl(fid.unique);
+                    cm_Gen8Dot3NameIntW(centry, &dfid, shortName, NULL);
 
-                /* delete first the long name and then the short name */
-                delete(op->scp->dirBplus, key);
-                key.name = shortName;
-                delete(op->scp->dirBplus, key);
-            }
+                    /* delete first the long name and then the short name */
+                    delete(op->scp->dirBplus, key);
+                    key.name = shortName;
+                    delete(op->scp->dirBplus, key);
+                }
+            } /* !NONODE */
         } else {
             clientchar_t * cname = NULL;