pts: Don't assume that pr_IdToName() was successful
authorChas Williams (CONTRACTOR) <chas@cmf.nrl.navy.mil>
Wed, 26 Mar 2014 14:25:13 +0000 (10:25 -0400)
committerD Brashear <shadow@your-file-system.com>
Wed, 2 Apr 2014 14:07:51 +0000 (07:07 -0700)
If pr_IdToName fails for some reason, tnames won't be available.

Change-Id: I5270ba0ecf3cfad9bfb909c97b27473d96ca1307
Reviewed-on: http://gerrit.openafs.org/10952
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

src/ptserver/pts.c

index 2fd4912..bd264e2 100644 (file)
@@ -539,12 +539,13 @@ GetNameOrId(struct cmd_syndesc *as, struct idlist *lids,
        code = pr_IdToName(&ids, &tnames);
        if (code)
            afs_com_err(whoami, code, "translating ids");
-       else
+       else {
            goodCount++;
-       if (lnames) {
-           for (x = 0; x < ids.idlist_len; x++)
-               strcpy(lnames->namelist_val[nd + x], tnames.namelist_val[x]);
-           lnames->namelist_len = nd + x;
+           if (lnames) {
+               for (x = 0; x < ids.idlist_len; x++)
+                   strcpy(lnames->namelist_val[nd + x], tnames.namelist_val[x]);
+               lnames->namelist_len = nd + x;
+           }
        }
     }
     /* treat things as working if any of the lookups worked */