From 21ca23297494f1cf8e578fd848bfcd0be2c360cd Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 29 Nov 2003 21:37:50 +0000 Subject: [PATCH] jbeuhler-flexelint-fun-with-printf-20031128 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 Comments - The fdset comment relates to a WinSock only file on which the size is a pointer to int. Modified the source to use a %p instead of %x as it is supported on Windows. Added an assert(p != NULL) to src/rx/rx_packet.c --- src/WINNT/afsd/afsd_init.c | 8 ++++---- src/WINNT/afsd/smb.c | 10 +++++----- src/WINNT/afsd/smb3.c | 4 ++-- src/WINNT/talocale/tal_alloc.cpp | 6 +++--- src/budb/ol_verify.c | 6 +++--- src/butc/tcmain.c | 2 +- src/butm/test_ftm.c | 2 +- src/config/util_cr.c | 4 ++-- src/dir/salvage.c | 12 ++++++------ src/kauth/user_nt.c | 4 ++-- src/libadmin/test/bos.c | 4 ++-- src/libadmin/test/kas.c | 2 +- src/rx/rx_packet.c | 17 +++++++++++++---- src/util/ktime.c | 18 +++++++++--------- src/vlserver/vldb_check.c | 2 +- src/vlserver/vlprocs.c | 2 +- src/vol/vnode.c | 6 +++--- src/vol/vol-info.c | 4 ++-- src/vol/vutil.c | 12 ++++++------ src/volser/vsprocs.c | 2 +- 20 files changed, 68 insertions(+), 59 deletions(-) diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index f0327d1bf..00fadf2bd 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -464,7 +464,7 @@ int afsd_InitCM(char **reasonP) /* 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; @@ -510,7 +510,7 @@ int afsd_InitCM(char **reasonP) 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; @@ -519,7 +519,7 @@ int afsd_InitCM(char **reasonP) 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; @@ -575,7 +575,7 @@ int afsd_InitCM(char **reasonP) 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; diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 3d6cfbe73..c7517baaf 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -780,7 +780,7 @@ smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags) 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; } } @@ -793,7 +793,7 @@ smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags) 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; @@ -834,7 +834,7 @@ smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern) 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; @@ -5378,10 +5378,10 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, 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); } diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 3d08c3a3f..827fee30b 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -177,7 +177,7 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * 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); @@ -584,7 +584,7 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) 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); diff --git a/src/WINNT/talocale/tal_alloc.cpp b/src/WINNT/talocale/tal_alloc.cpp index 9a687c54b..532d879e8 100644 --- a/src/WINNT/talocale/tal_alloc.cpp +++ b/src/WINNT/talocale/tal_alloc.cpp @@ -354,7 +354,7 @@ void SetDlgItemBytes (HWND hDlg, int idc, double lfValue) 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 @@ -666,10 +666,10 @@ void MemMgr_OnListAdd (PMEMCHUNK pCopy) 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) diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index 69c01c2b0..b2c48f2ed 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -294,10 +294,10 @@ char * 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]); @@ -1044,7 +1044,7 @@ verifyFreeLists() /* 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()) diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c index 892e834cb..1369978be 100644 --- a/src/butc/tcmain.c +++ b/src/butc/tcmain.c @@ -210,7 +210,7 @@ atocl(numstring, crunit, number) } 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) diff --git a/src/butm/test_ftm.c b/src/butm/test_ftm.c index f361fd7c6..973e6f218 100644 --- a/src/butm/test_ftm.c +++ b/src/butm/test_ftm.c @@ -388,7 +388,7 @@ PerformDumpTest(TestInfo * tip) 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); } diff --git a/src/config/util_cr.c b/src/config/util_cr.c index 39d156195..7fbc9a731 100644 --- a/src/config/util_cr.c +++ b/src/config/util_cr.c @@ -29,8 +29,8 @@ void 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 \ diff --git a/src/dir/salvage.c b/src/dir/salvage.c index 6e9852c73..e18add860 100644 --- a/src/dir/salvage.c +++ b/src/dir/salvage.c @@ -291,7 +291,7 @@ DirOK(file) /* 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; @@ -299,7 +299,7 @@ DirOK(file) /* 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); @@ -309,7 +309,7 @@ DirOK(file) /* 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); @@ -328,7 +328,7 @@ DirOK(file) 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; @@ -341,7 +341,7 @@ DirOK(file) } 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; @@ -355,7 +355,7 @@ DirOK(file) } 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; diff --git a/src/kauth/user_nt.c b/src/kauth/user_nt.c index 9d2c24939..49c7b14a1 100644 --- a/src/kauth/user_nt.c +++ b/src/kauth/user_nt.c @@ -797,14 +797,14 @@ send_recv(pkt, rpkt, f, _to) (void)fflush(stdout); } FD_ZERO(&readfds); - FD_SET(f, &readfds); + FD_SET(f,&readfds); errno = 0; /* select - either recv is ready, or timeout */ /* see if timeout or error or wrong descriptor */ if (select(f + 1, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout) < 1 || !FD_ISSET(f, &readfds)) { if (krb_debug) { - fprintf(stderr, "select failed: readfds=%x", readfds); + fprintf(stderr, "select failed: readfds=%p", readfds); perror(""); } return 0; diff --git a/src/libadmin/test/bos.c b/src/libadmin/test/bos.c index 47bb63b95..790d6c4a9 100644 --- a/src/libadmin/test/bos.c +++ b/src/libadmin/test/bos.c @@ -1093,8 +1093,8 @@ Print_bos_KeyInfo_p(bos_KeyInfo_p key, const char *prefix) 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); diff --git a/src/libadmin/test/kas.c b/src/libadmin/test/kas.c index c5bcd37f6..2be3e0567 100644 --- a/src/libadmin/test/kas.c +++ b/src/libadmin/test/kas.c @@ -589,7 +589,7 @@ Print_kas_serverDebugInfo_p(kas_serverDebugInfo_p debug, const char *prefix) 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, diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index c61f82cc9..045ece15c 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -476,7 +476,7 @@ rx_CheckPackets(void) 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"); @@ -648,7 +648,7 @@ rxi_AllocPacketNoLock(int class) 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 */ @@ -1645,7 +1645,7 @@ rxi_SendPacket(struct rx_call *call, struct rx_connection *conn, 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]++; @@ -1821,12 +1821,21 @@ rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn, 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)); + + assert(p != NULL); + + 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); + hadd32(peer->bytesSent, p->length); MUTEX_EXIT(&peer->peer_lock); } diff --git a/src/util/ktime.c b/src/util/ktime.c index 09f475c02..eba0260b9 100644 --- a/src/util/ktime.c +++ b/src/util/ktime.c @@ -502,9 +502,9 @@ static afs_int32 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) @@ -518,23 +518,23 @@ ktime_ParseDate(char *adate, struct ktime_date *akdate) 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; @@ -552,7 +552,7 @@ ktime_ParseDate(char *adate, struct ktime_date *akdate) akdate->year = year; akdate->month = month; - akdate->day = day; + akdate->day = day2; akdate->hour = hour; akdate->min = min; akdate->sec = sec; diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index 4869631c5..ce574a70a 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -970,7 +970,7 @@ WorkerBee(as, arock) 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)) diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index cf23de4fd..b2b8fc74f 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -1898,7 +1898,7 @@ SVL_GetStats(rxcall, stats, vital_header) #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)); diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 510ec375a..7a2fbc2fa 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -817,7 +817,7 @@ VVnodeWriteToRead_r(Error * ec, register Vnode * vnp) 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; } @@ -851,8 +851,8 @@ VVnodeWriteToRead_r(Error * ec, register Vnode * vnp) * 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)); diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index bbcb35684..6b92e2129 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -841,8 +841,8 @@ PrintVnodes(Volume * vp, VnodeClass class) 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) diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 4bd448a13..c9ec1d272 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -252,21 +252,21 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) 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; diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 568f90053..bf77d9648 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -3458,7 +3458,7 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver, 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. -- 2.39.5