bozo: Clean up bnode parms for each bnode
authorAndrew Deason <adeason@sinenomine.net>
Tue, 20 Jul 2010 17:06:57 +0000 (12:06 -0500)
committerDerrick Brashear <shadow@dementia.org>
Tue, 20 Jul 2010 18:11:39 +0000 (11:11 -0700)
bosserver was remembering the parms for past bnodes, and just
overwriting parms for new bnodes. This is a problem if we have a
'dafs' bnode followed by an 'fs' bnode, since the 'fs' bnode will get
the 'dasalvager' parm, and bosserver will think it is its scanner
program.

So instead keep track of a separate array of the parms that we
actually pass to bnode_Create, so we only pass parms that we saw for
this specific bnode.

Change-Id: Ic609e2156cfd8ecf5b83b3815c5dff235010aa00
Reviewed-on: http://gerrit.openafs.org/2452
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/bozo/bosserver.c

index 6a62302..0d1d479 100644 (file)
@@ -287,6 +287,7 @@ ReadBozoFile(char *aname)
     afs_int32 i, goal;
     struct bnode *tb;
     char *parms[MAXPARMS];
+    char *thisparms[MAXPARMS];
     int rmode;
 
     /* rename BozoInit to BosServer for the user */
@@ -402,6 +403,8 @@ ReadBozoFile(char *aname)
        } else if (code == 3)
            notifier = NULL;
 
+       memset(thisparms, 0, sizeof(thisparms));
+
        for (i = 0; i < MAXPARMS; i++) {
            /* now read the parms, until we see an "end" line */
            tp = fgets(tbuffer, sizeof(tbuffer), tfile);
@@ -419,12 +422,13 @@ ReadBozoFile(char *aname)
            if (!parms[i])      /* make sure there's space */
                parms[i] = (char *)malloc(BOZO_BSSIZE);
            strcpy(parms[i], tbuffer + 5);      /* remember the parameter for later */
+           thisparms[i] = parms[i];
        }
 
        /* ok, we have the type and parms, now create the object */
        code =
-           bnode_Create(typep, instp, &tb, parms[0], parms[1], parms[2],
-                        parms[3], parms[4], notifier,
+           bnode_Create(typep, instp, &tb, thisparms[0], thisparms[1],
+                        thisparms[2], thisparms[3], thisparms[4], notifier,
                         goal ? BSTAT_NORMAL : BSTAT_SHUTDOWN, 0);
        if (code)
            goto fail;