]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-verify-getcellbyindex-return-value-20020726
authorNickolai Zeldovich <kolya@mit.edu>
Fri, 26 Jul 2002 21:41:10 +0000 (21:41 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 26 Jul 2002 21:41:10 +0000 (21:41 +0000)
Verify that afs_GetCellByIndex() returns a valid cell -- it might
be NULL if afs_NewCell() aborted partway through, which could be
the case of the CellServDB file has a typo.

(cherry picked from commit 9d8ad37ced11afac107a2b7d8d1bd95c7e1aa9f8)

src/afs/afs_dynroot.c

index 7ca29aa428c04f09dd4731673fba6850eb3f1162..e42714b2cb8de24d9d4657e4e0a01f7a9b5b8a7e 100644 (file)
@@ -299,12 +299,13 @@ afs_RefreshDynroot()
 
     for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
        c = afs_GetCellByIndex(cellidx, READ_LOCK, 0 /* don't refresh */);
-       afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
-                             c->cellName, VNUM_FROM_CIDX_RW(cellidx, 0));
+       if (!c) continue;
 
        dotCell = afs_osi_Alloc(strlen(c->cellName) + 2);
        strcpy(dotCell, ".");
        strcat(dotCell, c->cellName);
+       afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+                             c->cellName, VNUM_FROM_CIDX_RW(cellidx, 0));
        afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
                              dotCell, VNUM_FROM_CIDX_RW(cellidx, 1));