]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
nuke-do-not-pass-null-rock-20060903
authorChaskiel M Grundman <cg2v@andrew.cmu.edu>
Sun, 3 Sep 2006 06:32:33 +0000 (06:32 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 3 Sep 2006 06:32:33 +0000 (06:32 +0000)
don't pass a null rock inot nuke(), fixing earlier introduced bug

src/vol/nuke.c

index 5b52e46a06b42c3a459f7a0767a967eae794781f..8c6ff93b90e93d33a5587a093b1fe6d1f9936803 100644 (file)
@@ -73,7 +73,7 @@ struct ilist {
  * Note that ainfo->u.param[0] is always the volume ID, for any vice inode.
  */
 static int
-NukeProc(struct ViceInodeInfo *ainfo, afs_int32 avolid, struct ilist *allInodes)
+NukeProc(struct ViceInodeInfo *ainfo, afs_int32 avolid, struct ilist **allInodes)
 {
     struct ilist *ti;
     register afs_int32 i;
@@ -86,13 +86,13 @@ NukeProc(struct ViceInodeInfo *ainfo, afs_int32 avolid, struct ilist *allInodes)
     if (ainfo->u.param[0] != avolid)
        return 0;               /* don't want this one */
     /* record the info */
-    if (!allInodes || allInodes->freePtr >= MAXATONCE) {
+    if (!*allInodes || (*allInodes)->freePtr >= MAXATONCE) {
        ti = (struct ilist *)malloc(sizeof(struct ilist));
        memset(ti, 0, sizeof(*ti));
-       ti->next = allInodes;
-       allInodes = ti;
+       ti->next = *allInodes;
+       *allInodes = ti;
     } else
-       ti = allInodes;         /* use the one with space */
+       ti = *allInodes;                /* use the one with space */
     i = ti->freePtr++;         /* find our slot in this mess */
     ti->inode[i] = ainfo->inodeNumber;
     ti->count[i] = ainfo->linkCount;
@@ -171,11 +171,11 @@ nuke(char *aname, afs_int32 avolid)
 #ifdef AFS_NAMEI_ENV
     code =
        ListViceInodes(lastDevComp, aname, NULL, NukeProc, avolid, &forceSal,
-                      0, wpath, allInodes);
+                      0, wpath, &allInodes);
 #else
     code =
        ListViceInodes(lastDevComp, aname, "/tmp/vNukeXX", NukeProc, avolid,
-                      &forceSal, 0, wpath, allInodes);
+                      &forceSal, 0, wpath, &allInodes);
     unlink("/tmp/vNukeXX");    /* clean it up now */
 #endif
     if (code == 0) {