]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Verify that afs_GetCellByIndex() returns a valid cell -- it might
authorNickolai Zeldovich <kolya@mit.edu>
Fri, 26 Jul 2002 21:27:55 +0000 (21:27 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Fri, 26 Jul 2002 21:27:55 +0000 (21:27 +0000)
be NULL if afs_NewCell() aborted partway through, which could be
the case of the CellServDB file has a typo.

src/afs/afs_dynroot.c

index 64096a818ef6302222b5029d881235aba4dfa10b..b90d968bcf211fc98b3969f5d4f698dac85d46bb 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));