Stop overanxious htonl in vldb_check -fix
authorRod Widdowson <rdw@steadingsoftware.com>
Sat, 15 May 2010 15:25:26 +0000 (16:25 +0100)
committerDerrick Brashear <shadow@dementia.org>
Mon, 17 May 2010 12:38:34 +0000 (05:38 -0700)
vldb_check -fix is corrupting the server entries (Number, Partition,
Flags).  This is because it is doing a htonl on what is a char field.
The read code already has a comment "make sure not to ntohl these,
as they're chars, not ints".

This change strips the corresponding htonl from writeheader (and puts
in a similar comment).

Change-Id: I5902be0f1e928521bfcb5ec66edd227c08ea2bdc
Reviewed-on: http://gerrit.openafs.org/1964
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/vlserver/vldb_check.c

index 5eb1ed9..d04af37 100644 (file)
@@ -459,9 +459,10 @@ writeentry(afs_int32 addr, struct nvlentry *vlentryp)
        vlentryp->nextIdHash[i] = htonl(vlentryp->nextIdHash[i]);
     vlentryp->nextNameHash = htonl(vlentryp->nextNameHash);
     for (i = 0; i < NMAXNSERVERS; i++) {
-       vlentryp->serverNumber[i] = htonl(vlentryp->serverNumber[i]);
-       vlentryp->serverPartition[i] = htonl(vlentryp->serverPartition[i]);
-       vlentryp->serverFlags[i] = htonl(vlentryp->serverFlags[i]);
+       /* make sure not to htonl these, as they're chars, not ints */
+       vlentryp->serverNumber[i] =  vlentryp->serverNumber[i] ;
+       vlentryp->serverPartition[i] = vlentryp->serverPartition[i] ;
+       vlentryp->serverFlags[i] = vlentryp->serverFlags[i] ;
     }
     vldbwrite(addr, (char *)vlentryp, sizeof(*vlentryp));
 }