[OpenAFS-devel] [PATCH] flexelint: fun with printf

Joe Buehler jbuehler@hekimian.com
Fri, 21 Nov 2003 14:45:57 -0500


This is a multi-part message in MIME format.
--------------060207090902050802070403
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

This patch addresses a number of problems with printf-like functions.

Most of them are %x formats applied to pointers (which could be a
problem depending on the architecture I would assume).  There is a
%p format for pointers on many machines but I don't know if it
applies to all supported OpenAFS platforms so I didn't go that route.

There is a buffer overflow fix to ktime.c

There are a couple places where incorrect format characters were used.

One call had two arguments swapped.

Other fixes include the use of PrintInode() and %s formats for
printing inode numbers.  The code was inconsistent in this regard -- sometimes
PrintInode() was used, sometimes it was side-stepped.

There is one place where a local shadowed another variable, so I renamed
the local.

The last segment points out that an fdset need not be anything printable
with an integer format.
-- 
Joe Buehler


--------------060207090902050802070403
Content-Type: text/plain;
 name="temp.patch.printf"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="temp.patch.printf"

--- ./src/WINNT/afsd/afsd_init.c.~1~	2003-06-06 17:11:25.000000000 -0400
+++ ./src/WINNT/afsd/afsd_init.c	2003-11-20 13:25:15.000000000 -0500
@@ -448,7 +446,7 @@
         
 	/* setup and enable debug log */
 	afsd_logp = osi_LogCreate("afsd", traceBufSize);
-	afsi_log("osi_LogCreate log addr %x", afsd_logp);
+	afsi_log("osi_LogCreate log addr %x", (int)afsd_logp);
         osi_LogEnable(afsd_logp);
 	logReady = 1;
 
--- ./src/WINNT/afsd/afsd_init.c.~1~	2003-06-06 17:11:25.000000000 -0400
+++ ./src/WINNT/afsd/afsd_init.c	2003-11-20 13:25:15.000000000 -0500
@@ -494,7 +492,7 @@
 	nullServerSecurityClassp = rxnull_NewServerSecurityObject();
         serverp = rx_NewService(0, 1, "AFS", &nullServerSecurityClassp, 1,
         	RXAFSCB_ExecuteRequest);
-	afsi_log("rx_NewService addr %x", serverp);
+	afsi_log("rx_NewService addr %x", (int)serverp);
 	if (serverp == NULL) {
 		*reasonP = "unknown error";
 		return -1;
--- ./src/WINNT/afsd/afsd_init.c.~1~	2003-06-06 17:11:25.000000000 -0400
+++ ./src/WINNT/afsd/afsd_init.c	2003-11-20 13:25:15.000000000 -0500
@@ -503,7 +501,7 @@
 	nullServerSecurityClassp = rxnull_NewServerSecurityObject();
         serverp = rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats",
 		&nullServerSecurityClassp, 1, RXSTATS_ExecuteRequest);
-	afsi_log("rx_NewService addr %x", serverp);
+	afsi_log("rx_NewService addr %x", (int)serverp);
 	if (serverp == NULL) {
 		*reasonP = "unknown error";
 		return -1;
--- ./src/WINNT/afsd/afsd_init.c.~1~	2003-06-06 17:11:25.000000000 -0400
+++ ./src/WINNT/afsd/afsd_init.c	2003-11-20 13:25:15.000000000 -0500
@@ -559,7 +557,7 @@
 
         if (code == 0 && !cm_freelanceEnabled) {
 	  cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE);
-          afsi_log("cm_GetCell addr %x", cm_rootCellp);
+          afsi_log("cm_GetCell addr %x", (int)cm_rootCellp);
 	  if (cm_rootCellp == NULL) {
 	    *reasonP = "can't find root cell in afsdcell.ini";
 	    return -1;
--- ./src/WINNT/afsd/afsd_init.c.~1~	2003-06-06 17:11:25.000000000 -0400
+++ ./src/WINNT/afsd/afsd_init.c	2003-11-20 13:25:15.000000000 -0500
@@ -587,7 +585,7 @@
           code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp,
                                     &req, CM_FLAG_CREATE, &cm_rootVolumep);
           afsi_log("cm_GetVolumeByName code %x root vol %x", code,
-                   (code ? 0xffffffff : cm_rootVolumep));
+                   (int)(code ? (cm_volume_t *)-1 : cm_rootVolumep));
           if (code != 0) {
             *reasonP = "can't find root volume in root cell";
             return -1;
--- ./src/WINNT/afsd/afsd_init.c.~1~	2003-06-06 17:11:25.000000000 -0400
+++ ./src/WINNT/afsd/afsd_init.c	2003-11-20 13:25:15.000000000 -0500
@@ -606,7 +604,7 @@
         
         code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req);
 	afsi_log("cm_GetSCache code %x scache %x", code,
-		 (code ? 0xffffffff : cm_rootSCachep));
+		 (int)(code ? (cm_scache_t *)-1 : cm_rootSCachep));
 	if (code != 0) {
 		*reasonP = "unknown error";
 		return -1;
--- ./src/WINNT/afsd/smb.c.~1~	2003-08-25 14:24:22.000000000 -0400
+++ ./src/WINNT/afsd/smb.c	2003-11-20 13:33:57.000000000 -0500
@@ -780,7 +780,7 @@
 	for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
 		if (uid == uidp->userID) {
 			uidp->refCount++;
-			osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp) ? uidp->unp->name : "");
+			osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",(int)vcp,uidp->userID,(uidp->unp) ? uidp->unp->name : "");
         	break;
 		}
         }
--- ./src/WINNT/afsd/smb.c.~1~	2003-08-25 14:24:22.000000000 -0400
+++ ./src/WINNT/afsd/smb.c	2003-11-20 13:33:57.000000000 -0500
@@ -793,7 +793,7 @@
                 vcp->usersp = uidp;
                 lock_InitializeMutex(&uidp->mx, "uid_t mutex");
                 uidp->userID = uid;
-				osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL,"VCP[%x] new-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
+				osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL,"VCP[%x] new-uid[%d] name[%s]",(int)vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
         }
         lock_ReleaseWrite(&smb_rctLock);
         return uidp;
--- ./src/WINNT/afsd/smb.c.~1~	2003-08-25 14:24:22.000000000 -0400
+++ ./src/WINNT/afsd/smb.c	2003-11-20 13:33:57.000000000 -0500
@@ -834,7 +834,7 @@
             continue;
           if (stricmp(uidp->unp->name, usern) == 0) {
             uidp->refCount++;
-			osi_LogEvent("AFS smb_FindUserByNameThisSession",NULL,"VCP[%x] uid[%d] match-name[%s]",vcp,uidp->userID,usern);
+			osi_LogEvent("AFS smb_FindUserByNameThisSession",NULL,"VCP[%x] uid[%d] match-name[%s]",(int)vcp,uidp->userID,usern);
             break;
           } else
             continue;
--- ./src/WINNT/afsd/smb.c.~1~	2003-08-25 14:24:22.000000000 -0400
+++ ./src/WINNT/afsd/smb.c	2003-11-20 13:33:57.000000000 -0500
@@ -5378,10 +5378,10 @@
 				code = smb_ReceiveCoreWriteRaw (vcp, inp, outp,
 								rwcp);
 			else {
-					osi_LogEvent("AFS Dispatch %s",(myCrt_Dispatch(inp->inCom)),"vcp[%x] lana[%d] lsn[%d]",vcp,vcp->lana,vcp->lsn);
+					osi_LogEvent("AFS Dispatch %s",(myCrt_Dispatch(inp->inCom)),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn);
 					osi_Log4(afsd_logp,"Dispatch %s vcp[%x] lana[%d] lsn[%d]",(myCrt_Dispatch(inp->inCom)),vcp,vcp->lana,vcp->lsn);
 					code = (*(dp->procp)) (vcp, inp, outp);
-					osi_LogEvent("AFS Dispatch return",NULL,"Code[%d]",(code==0)?0:code-CM_ERROR_BASE,"");
+					osi_LogEvent("AFS Dispatch return",NULL,"Code[%d]",(code==0)?0:code-CM_ERROR_BASE);
 					osi_Log1(afsd_logp,"Dispatch return  code[%d]",(code==0)?0:code-CM_ERROR_BASE);
 				}
 
--- ./src/WINNT/afsd/smb3.c.~1~	2003-07-10 22:12:46.000000000 -0400
+++ ./src/WINNT/afsd/smb3.c	2003-11-20 14:14:12.000000000 -0500
@@ -177,7 +175,7 @@
         uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
         lock_ObtainMutex(&uidp->mx);
         uidp->unp = unp;
-		osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern);
+		osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",(int)vcp,vcp->lana,vcp->lsn,newUid,usern);
 		osi_Log4(afsd_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp->lana,vcp->lsn,newUid);
         lock_ReleaseMutex(&uidp->mx);
         smb_ReleaseUID(uidp);
--- ./src/WINNT/afsd/smb3.c.~1~	2003-07-10 22:12:46.000000000 -0400
+++ ./src/WINNT/afsd/smb3.c	2003-11-20 14:14:12.000000000 -0500
@@ -584,7 +582,7 @@
                 lock_ReleaseWrite(&smb_globalLock);
                 
                 /* now dispatch it */
-				osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",vcp,vcp->lana,vcp->lsn);
+				osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn);
 				osi_Log4(afsd_logp,"AFS Server - Dispatch-2 %s vcp[%x] lana[%d] lsn[%d]",myCrt_2Dispatch(asp->opcode),vcp,vcp->lana,vcp->lsn);
                 code = (*smb_tran2DispatchTable[asp->opcode].procp)(vcp, asp, outp);
 
--- ./src/WINNT/talocale/tal_alloc.cpp.~1~	2003-08-25 14:24:27.000000000 -0400
+++ ./src/WINNT/talocale/tal_alloc.cpp	2003-11-20 14:20:31.000000000 -0500
@@ -354,7 +354,7 @@
 void MemMgr_ShowWarning (PMEMCHUNK pChunk, LPSTR pszFile, DWORD dwLine, LPTSTR pszDesc)
 {
    TCHAR szMessage[ 1024 ];
-   wsprintf (szMessage, TEXT("%s\n\n   Address: 0x%08lX (%s)\n   Allocated: %s line %ld\n   Freed: %s line %ld\n\nClick OK for memory details."), pszDesc, pChunk->pData, pChunk->pszExpr, pChunk->pszFile, pChunk->dwLine, pszFile, dwLine);
+   wsprintf (szMessage, TEXT("%s\n\n   Address: 0x%08lX (%s)\n   Allocated: %s line %ld\n   Freed: %s line %ld\n\nClick OK for memory details."), pszDesc, (long)pChunk->pData, pChunk->pszExpr, pChunk->pszFile, pChunk->dwLine, pszFile, dwLine);
    if (MessageBox (NULL, szMessage, cszTITLE, MB_ICONHAND | MB_OKCANCEL | MB_DEFBUTTON2) == IDOK)
       {
       // TODO: Show Details
--- ./src/WINNT/talocale/tal_alloc.cpp.~1~	2003-08-25 14:24:27.000000000 -0400
+++ ./src/WINNT/talocale/tal_alloc.cpp	2003-11-20 14:20:31.000000000 -0500
@@ -666,10 +666,10 @@
       wsprintf (szLocation, TEXT("%s, %ld"), pszFile, pCopy->dwLine);
 
    TCHAR szBytes[256];
-   FormatBytes (szBytes, pCopy->cbData);
+   FormatBytes (szBytes, (double)pCopy->cbData);
 
    TCHAR szAddress[256];
-   wsprintf (szAddress, TEXT("0x%08lX"), pCopy->pData);
+   wsprintf (szAddress, TEXT("0x%08lX"), (long)pCopy->pData);
 
    LPTSTR pszKey = NULL;
    switch (lr.iColSort)
--- ./src/budb/ol_verify.c.~1~	2003-07-15 19:14:48.000000000 -0400
+++ ./src/budb/ol_verify.c	2003-11-20 15:32:46.000000000 -0500
@@ -292,10 +295,10 @@
 TypeName(index)
      int index;
 {
-    static char error[16];
+    static char error[36];
 
     if ((index < 0) || (index >= NBLOCKTYPES)) {
-	sprintf(error, "UNKNOWN_TYPE", index);
+	sprintf(error, "UNKNOWN_TYPE %d", index);
 	return (error);
     }
     return (typeName[index]);
--- ./src/budb/ol_verify.c.~1~	2003-07-15 19:14:48.000000000 -0400
+++ ./src/budb/ol_verify.c	2003-11-20 15:32:46.000000000 -0500
@@ -1043,7 +1046,7 @@
 
 	    /* check block type */
 	    if (blockMap[blockIndex]->header.type != i) {
-		Log("verifyFreeLists: Found %s type in %s free chain\n",
+		Log("verifyFreeLists: Found %s type in %s free chain (addr 0x%x)\n",
 		    TypeName(blockMap[blockIndex]->header.type), TypeName(i),
 		    addr);
 		if (BumpErrors())
--- ./src/butc/tcmain.c.~1~	2003-08-08 17:54:36.000000000 -0400
+++ ./src/butc/tcmain.c	2003-11-20 12:11:08.000000000 -0500
@@ -210,7 +210,7 @@
     }
 
     count =
-	sscanf(numstring, "%f%c%s", (unsigned char *)&total, &cunit, rest);
+	sscanf(numstring, "%f%c%s", &total, &cunit, rest);
     if ((count > 2) || (count <= 0))
 	return -1;
     if (count == 1)
--- ./src/butm/test_ftm.c.~1~	2003-07-15 19:14:50.000000000 -0400
+++ ./src/butm/test_ftm.c	2003-11-20 11:48:27.000000000 -0500
@@ -388,7 +388,7 @@
 	    if ((tlen == 0) && (flen == 0))
 		break;		/* correct termination */
 	    if (flen != tlen) {
-		printf("File length mismatch for %dth file (%d)\n", i,
+		printf("File length mismatch for %dth file (%s)\n", i,
 		       tip->files[i]);
 		ERROR_EXIT(6);
 	    }
--- ./src/dir/salvage.c.~1~	2003-07-15 19:15:02.000000000 -0400
+++ ./src/dir/salvage.c	2003-11-20 14:31:36.000000000 -0500
@@ -291,7 +288,7 @@
 	    /* A null name is no good */
 	    if (ep->name[0] == '\000') {
 		printf("Dir entry %x in chain %d has bogus (null) name.\n",
-		       ep, i);
+		       (int)ep, i);
 		DRelease(ep, 0);
 		DRelease(dhp, 0);
 		return 0;
--- ./src/dir/salvage.c.~1~	2003-07-15 19:15:02.000000000 -0400
+++ ./src/dir/salvage.c	2003-11-20 14:31:36.000000000 -0500
@@ -299,7 +297,7 @@
 
 	    /* The entry flag better be FFIRST */
 	    if (ep->flag != FFIRST) {
-		printf("Dir entry %x in chain %d has bogus flag field.\n", ep,
+		printf("Dir entry %x in chain %d has bogus flag field.\n", (int)ep,
 		       i);
 		DRelease(ep, 0);
 		DRelease(dhp, 0);
--- ./src/dir/salvage.c.~1~	2003-07-15 19:15:02.000000000 -0400
+++ ./src/dir/salvage.c	2003-11-20 14:31:36.000000000 -0500
@@ -309,7 +307,7 @@
 	    /* Check the size of the name */
 	    j = strlen(ep->name);
 	    if (j >= MAXENAME) {	/* MAXENAME counts the null */
-		printf("Dir entry %x in chain %d has too-long name.\n", ep,
+		printf("Dir entry %x in chain %d has too-long name.\n", (int)ep,
 		       i);
 		DRelease(ep, 0);
 		DRelease(dhp, 0);
--- ./src/dir/salvage.c.~1~	2003-07-15 19:15:02.000000000 -0400
+++ ./src/dir/salvage.c	2003-11-20 14:31:36.000000000 -0500
@@ -328,7 +326,7 @@
 	    if ((j = DirHash(ep->name)) != i) {
 		printf
 		    ("Dir entry %x should be in hash bucket %d but IS in %d.\n",
-		     ep, j, i);
+		     (int)ep, j, i);
 		DRelease(ep, 0);
 		DRelease(dhp, 0);
 		return 0;
--- ./src/dir/salvage.c.~1~	2003-07-15 19:15:02.000000000 -0400
+++ ./src/dir/salvage.c	2003-11-20 14:31:36.000000000 -0500
@@ -341,7 +339,7 @@
 		} else {
 		    printf
 			("Dir entry %x, index 13 has name '%s' should be '.'\n",
-			 ep, ep->name);
+			 (int)ep, ep->name);
 		    DRelease(ep, 0);
 		    DRelease(dhp, 0);
 		    return 0;
--- ./src/dir/salvage.c.~1~	2003-07-15 19:15:02.000000000 -0400
+++ ./src/dir/salvage.c	2003-11-20 14:31:36.000000000 -0500
@@ -355,7 +353,7 @@
 		} else {
 		    printf
 			("Dir entry %x, index 14 has name '%s' should be '..'\n",
-			 ep, ep->name);
+			 (int)ep, ep->name);
 		    DRelease(ep, 0);
 		    DRelease(dhp, 0);
 		    return 0;
--- ./src/libadmin/test/bos.c.~1~	2003-08-08 17:54:41.000000000 -0400
+++ ./src/libadmin/test/bos.c	2003-11-20 15:14:15.000000000 -0500
@@ -1093,8 +1094,8 @@
     printf("%sVersion number: %d\n", prefix, key->keyVersionNumber);
     printf("%sLast modification date %d\n", prefix,
 	   key->keyStatus.lastModificationDate);
-    printf("%sLast modification micro seconds %d\n",
-	   key->keyStatus.lastModificationMicroSeconds, prefix);
+    printf("%sLast modification micro seconds %d\n", prefix,
+	   key->keyStatus.lastModificationMicroSeconds);
     printf("%sChecksum %u\n", prefix, key->keyStatus.checkSum);
 
     printf("%sKey: \n", prefix);
--- ./src/libadmin/test/kas.c.~1~	2003-08-08 17:54:41.000000000 -0400
+++ ./src/libadmin/test/kas.c	2003-11-20 13:33:37.000000000 -0500
@@ -589,7 +589,7 @@
     printf("%sCurrent time %s\n", prefix, ctime(&time));
     printf("%sNo auth %d\n", prefix, debug->noAuth);
     time = debug->lastTransaction;
-    printf("%sLast transaction %d\n", prefix, ctime(&time));
+    printf("%sLast transaction %s\n", prefix, ctime(&time));
     printf("%sLast operation %s\n", prefix, debug->lastOperation);
     printf("%sLast principal auth %s\n", prefix, debug->lastPrincipalAuth);
     printf("%sLast principal UDP auth %s\n", prefix,
--- ./src/rx/rx_packet.c.~1~	2003-07-15 19:16:09.000000000 -0400
+++ ./src/rx/rx_packet.c	2003-11-20 12:12:25.000000000 -0500
@@ -476,7 +476,7 @@
 void
 rxi_FreePacketNoLock(struct rx_packet *p)
 {
-    dpf(("Free %x\n", p));
+    dpf(("Free %x\n", (int)p));
 
     if (p->flags & RX_PKTFLAG_FREE)
 	osi_Panic("rxi_FreePacketNoLock: packet already free\n");
--- ./src/rx/rx_packet.c.~1~	2003-07-15 19:16:09.000000000 -0400
+++ ./src/rx/rx_packet.c	2003-11-20 12:12:25.000000000 -0500
@@ -648,7 +648,7 @@
     if (!(p->flags & RX_PKTFLAG_FREE))
 	osi_Panic("rxi_AllocPacket: packet not free\n");
 
-    dpf(("Alloc %x, class %d\n", p, class));
+    dpf(("Alloc %x, class %d\n", (int)p, class));
 
     queue_Remove(p);
     p->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */
--- ./src/rx/rx_packet.c.~1~	2003-07-15 19:16:09.000000000 -0400
+++ ./src/rx/rx_packet.c	2003-11-20 12:12:25.000000000 -0500
@@ -1645,7 +1645,7 @@
 	AFS_RXGLOCK();
 #ifdef RXDEBUG
     }
-    dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %x resend %d.%0.3d len %d", deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], peer->host, peer->port, p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber, p->header.seq, p->header.flags, p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));
+    dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %x resend %d.%0.3d len %d", deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], peer->host, peer->port, p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber, p->header.seq, p->header.flags, (int)p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));
 #endif
     MUTEX_ENTER(&rx_stats_mutex);
     rx_stats.packetsSent[p->header.type - 1]++;
--- ./src/rx/rx_packet.c.~1~	2003-07-15 19:16:09.000000000 -0400
+++ ./src/rx/rx_packet.c	2003-11-20 12:12:25.000000000 -0500
@@ -1821,12 +1823,14 @@
 	AFS_RXGLOCK();
 #ifdef RXDEBUG
     }
-    dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %x resend %d.%0.3d len %d", deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], peer->host, peer->port, p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber, p->header.seq, p->header.flags, p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));
+    /* FIXME: p should really be checked for a null pointer in the following */
+    dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %x resend %d.%0.3d len %d", deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], peer->host, peer->port, p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber, p->header.seq, p->header.flags, (int)p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));
 #endif
     MUTEX_ENTER(&rx_stats_mutex);
     rx_stats.packetsSent[p->header.type - 1]++;
     MUTEX_EXIT(&rx_stats_mutex);
     MUTEX_ENTER(&peer->peer_lock);
+    /* FIXME: p should really be checked for a null pointer in the following */
     hadd32(peer->bytesSent, p->length);
     MUTEX_EXIT(&peer->peer_lock);
 }
--- ./src/util/ktime.c.~1~	2003-07-15 19:17:16.000000000 -0400
+++ ./src/util/ktime.c	2003-11-18 12:34:44.000000000 -0500
@@ -502,9 +503,9 @@
 ktime_ParseDate(char *adate, struct ktime_date *akdate)
 {
     int code;
-    afs_int32 month, day, year, hour, min, sec;
+    afs_int32 month, day2, year, hour, min, sec;
     char never[7];
-    char c;
+    char c[2];
 
     lcstring(never, adate, sizeof(never));
     if (strcmp(never, "never") == 0)
--- ./src/util/ktime.c.~1~	2003-07-15 19:17:16.000000000 -0400
+++ ./src/util/ktime.c	2003-11-18 12:34:44.000000000 -0500
@@ -518,23 +519,23 @@
 
 
     code =
-	sscanf(adate, "%d / %d / %d %d : %d : %d%1s", &month, &day, &year,
-	       &hour, &min, &sec, &c);
+	sscanf(adate, "%d / %d / %d %d : %d : %d%1s", &month, &day2, &year,
+	       &hour, &min, &sec, &c[0]);
     if (code != 6) {
 	sec = 0;
 	code =
-	    sscanf(adate, "%d / %d / %d %d : %d%1s", &month, &day, &year,
-		   &hour, &min, &c);
+	    sscanf(adate, "%d / %d / %d %d : %d%1s", &month, &day2, &year,
+		   &hour, &min, &c[0]);
 	if (code != 5) {
 	    hour = min = 0;
-	    code = sscanf(adate, "%d / %d / %d%1s", &month, &day, &year, &c);
+	    code = sscanf(adate, "%d / %d / %d%1s", &month, &day2, &year, &c[0]);
 	    if (code != 3) {
 		return -1;
 	    }
 	}
     }
 
-    if ((year < 0) || (month < 1) || (month > 12) || (day < 1) || (day > 31) ||	/* more or less */
+    if ((year < 0) || (month < 1) || (month > 12) || (day2 < 1) || (day2 > 31) ||	/* more or less */
 	(hour < 0) || (hour > 23) || (min < 0) || (min > 59) || (sec < 0)
 	|| (sec > 59))
 	return -2;
--- ./src/util/ktime.c.~1~	2003-07-15 19:17:16.000000000 -0400
+++ ./src/util/ktime.c	2003-11-18 12:34:44.000000000 -0500
@@ -552,7 +553,7 @@
 
     akdate->year = year;
     akdate->month = month;
-    akdate->day = day;
+    akdate->day = day2;
     akdate->hour = hour;
     akdate->min = min;
     akdate->sec = sec;
--- ./src/vlserver/vldb_check.c.~1~	2003-07-15 19:17:34.000000000 -0400
+++ ./src/vlserver/vldb_check.c	2003-11-20 13:30:35.000000000 -0500
@@ -970,7 +970,7 @@
 	    readentry(record[i].addr, &vlentry, &type);
 
 	    if (InvalidVolname(vlentry.name))
-		printf("Volume '%s' at addr has an invalid name\n",
+		printf("Volume '%s' at addr %u has an invalid name\n",
 		       vlentry.name, record[i].addr);
 
 	    if (!(record[i].type & NH))
--- ./src/vlserver/vlprocs.c.~1~	2003-11-12 09:23:30.000000000 -0500
+++ ./src/vlserver/vlprocs.c	2003-11-20 13:37:25.000000000 -0500
@@ -1898,7 +1898,7 @@
 #endif
     if (errorcode = Init_VLdbase(&trans, LOCKREAD, this_op))
 	return errorcode;
-    VLog(5, ("GetStats %\n", rxinfo(rxcall)));
+    VLog(5, ("GetStats %s\n", rxinfo(rxcall)));
     memcpy((char *)vital_header, (char *)&cheader.vital_header,
 	   sizeof(vital_vlheader));
     memcpy((char *)stats, (char *)&dynamic_statistics, sizeof(vldstats));
--- ./src/vol/vnode.c.~1~	2003-07-15 19:17:40.000000000 -0400
+++ ./src/vol/vnode.c	2003-11-20 13:52:55.000000000 -0500
@@ -817,7 +820,7 @@
 					    changed_oldTime) << 1) | vnp->
 	  delete);
     if (thisProcess != vnp->writer)
-	Abort("VPutVnode: Vnode at 0x%x locked by another process!\n", vnp);
+	Abort("VPutVnode: Vnode at 0x%x locked by another process!\n", (int)vnp);
     if (vnp->delete) {
 	return 0;
     }
--- ./src/vol/vnode.c.~1~	2003-07-15 19:17:40.000000000 -0400
+++ ./src/vol/vnode.c	2003-11-20 13:52:55.000000000 -0500
@@ -851,8 +854,8 @@
 		 * range or the inode table is full.
 		 */
 		VOL_LOCK if (code == BAD_IGET) {
-		    Log("VPutVnode: bad inumber %llu\n",
-			(afs_uintmax_t) vp->vnodeIndex[class].handle->ih_ino);
+		    Log("VPutVnode: bad inumber %s\n",
+			PrintInode(NULL, vp->vnodeIndex[class].handle->ih_ino));
 		    *ec = VIO;
 		} else {
 		    Log("VPutVnode: Couldn't write vnode %u, volume %u (%s)\n", vnp->vnodeNumber, V_id(vnp->volumePtr), V_name(vnp->volumePtr));
--- ./src/vol/vol-info.c.~1~	2003-08-08 16:40:45.000000000 -0400
+++ ./src/vol/vol-info.c	2003-11-20 11:59:16.000000000 -0500
@@ -841,8 +841,8 @@
 		FDH_REALLYCLOSE(fdP1);
 		IH_RELEASE(ih1);
 		close(ofd);
-		printf("... Copied inode %llu to file %s (%d bytes)\n",
-		       (afs_uintmax_t) ino, nfile, total);
+		printf("... Copied inode %s to file %s (%d bytes)\n",
+		       PrintInode(NULL, ino), nfile, total);
 	    }
 	} else {
 #if defined(AFS_NAMEI_ENV)
--- ./src/vol/vutil.c.~1~	2003-08-08 16:40:45.000000000 -0400
+++ ./src/vol/vutil.c	2003-11-20 11:56:48.000000000 -0500
@@ -252,21 +252,21 @@
     IH_INIT(handle, device, vol.parentId, tempHeader.volumeInfo);
     fdP = IH_OPEN(handle);
     if (fdP == NULL) {
-	Log("VCreateVolume:  Problem iopen inode %llu (err=%d)\n",
-	    (afs_uintmax_t) tempHeader.volumeInfo, errno);
+	Log("VCreateVolume:  Problem iopen inode %s (err=%d)\n",
+	    PrintInode(NULL, tempHeader.volumeInfo), errno);
 	unlink(volumePath);
 	goto bad;
     }
     if (FDH_SEEK(fdP, 0, SEEK_SET) < 0) {
-	Log("VCreateVolume:  Problem lseek inode %llu (err=%d)\n",
-	    (afs_uintmax_t) tempHeader.volumeInfo, errno);
+	Log("VCreateVolume:  Problem lseek inode %s (err=%d)\n",
+	    PrintInode(NULL, tempHeader.volumeInfo), errno);
 	FDH_REALLYCLOSE(fdP);
 	unlink(volumePath);
 	goto bad;
     }
     if (FDH_WRITE(fdP, (char *)&vol, sizeof(vol)) != sizeof(vol)) {
-	Log("VCreateVolume:  Problem writing to  inode %llu (err=%d)\n",
-	    (afs_uintmax_t) tempHeader.volumeInfo, errno);
+	Log("VCreateVolume:  Problem writing to  inode %s (err=%d)\n",
+	    PrintInode(NULL, tempHeader.volumeInfo), errno);
 	FDH_REALLYCLOSE(fdP);
 	unlink(volumePath);
 	goto bad;
--- ./src/volser/vsprocs.c.~1~	2003-07-15 19:17:49.000000000 -0400
+++ ./src/volser/vsprocs.c	2003-11-20 21:55:04.000000000 -0500
@@ -3408,7 +3397,7 @@
 	    replicas[i].trans = 0;
 	    if (code) {
 		fprintf(STDERR,
-			"Failed to end transaction on ro volume %u at server 0x%x\n",
+			"Failed to end transaction on ro volume %u at server %s\n",
 			entry.volumeId[ROVOL],
 			hostutil_GetNameByINet(htonl
 					       (replicas[i].server.
--- ./src/config/util_cr.c.~1~	2003-07-15 19:14:56.000000000 -0400
+++ ./src/config/util_cr.c	2003-11-18 12:52:19.000000000 -0500
@@ -29,8 +29,8 @@
 usuage()
 {
     printf("util_cr file ;remove cr (from crlf)\n\
-	OR util_cr } ProductVersion in_filename out_filename ; substitute for %1-%5 in file\n\
-	   %1=Major version, %2=Minor version, %3=Patch(first digit) %4=(last two digits) %5=Version display string \n\
+	OR util_cr } ProductVersion in_filename out_filename ; substitute for %%1-%%5 in file\n\
+	   %%1=Major version, %%2=Minor version, %%3=Patch(first digit) %%4=(last two digits) %%5=Version display string \n\
 	   ProductVersion=maj.min.pat.pat2 ;maj=numeric, min=numeric pat,pat2 are not more than 3 digits or 1-2 digits and one alpha \n\
 	   e.g 1.0.4.1, 1.0.4 a 1.0.401, 1.0.4a  all represent the same version\n\
 	OR util_cr + file ;add cr\n \
--- ./src/kauth/user_nt.c.~1~	2003-08-08 17:54:40.000000000 -0400
+++ ./src/kauth/user_nt.c	2003-11-20 11:46:47.000000000 -0500
@@ -804,6 +804,7 @@
     if (select(f + 1, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout) < 1
 	|| !FD_ISSET(f, &readfds)) {
 	if (krb_debug) {
+	    /* FIXME: format incorrect, no telling how big readfds is */
 	    fprintf(stderr, "select failed: readfds=%x", readfds);
 	    perror("");
 	}

--------------060207090902050802070403--