From 54ce580ef3fdb6c98a80d1104728b1e25d3fb9ff Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 4 Apr 2006 21:51:13 +0000 Subject: [PATCH] time-t-casting-fixes-20060404 FIXES 15169 hopefully the rest of this --- src/afsmonitor/afsmon-output.c | 22 +++++++++++----- src/afsmonitor/afsmon-parselog.c | 5 ++-- src/afsweb/apache_afs_weblog.c | 2 +- src/budb/struct_ops.c | 55 +++++++++++++++++++++------------------- src/kauth/rebuild.c | 9 ++++--- src/package/update.c | 3 ++- src/tests/dumptool.c | 10 +++++--- src/venus/fstrace.c | 10 +++++--- src/viced/host.c | 8 +++--- src/vlserver/vlclient.c | 3 ++- src/vol/vol-salvage.c | 6 +++-- src/volser/vsprocs.c | 13 +++++++--- src/xstat/xstat_cm_test.c | 13 ++++++---- src/xstat/xstat_fs_test.c | 9 ++++--- 14 files changed, 104 insertions(+), 64 deletions(-) diff --git a/src/afsmonitor/afsmon-output.c b/src/afsmonitor/afsmon-output.c index 15b3caf..5ab39e4 100644 --- a/src/afsmonitor/afsmon-output.c +++ b/src/afsmonitor/afsmon-output.c @@ -389,7 +389,7 @@ Print_fs_FullPerfInfo(a_fs_Results) afs_int32 numLongs; /*# longwords received */ struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */ char *printableTime; /*Ptr to printable time string */ - + time_t probeTime; numLongs = a_fs_Results->data.AFS_CollData_len; if (numLongs != fullPerfLongs) { @@ -400,7 +400,8 @@ Print_fs_FullPerfInfo(a_fs_Results) return; } - printableTime = ctime((time_t *) & (a_fs_Results->probeTime)); + probeTime = a_fs_Results->probeTime; + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; fullPerfP = (struct fs_stats_FullPerfStats *) (a_fs_Results->data.AFS_CollData_val); @@ -449,6 +450,7 @@ afsmon_fsOutput(a_outfile, a_detOutput) afs_int32 numLongs; /* longwords in result */ afs_int32 *currLong; /* ptr to longwords in result */ int i; + time_t probeTime; if (afsmon_debug) { fprintf(debugFD, "[ %s ] Called, a_outfile= %s, a_detOutput= %d\n", @@ -464,7 +466,8 @@ afsmon_fsOutput(a_outfile, a_detOutput) } /* get the probe time and strip the \n at the end */ - printTime = ctime((time_t *) & (xstat_fs_Results.probeTime)); + probeTime = xstat_fs_Results.probeTime; + printTime = ctime(&probeTime); printTime[strlen(printTime) - 1] = '\0'; hostname = xstat_fs_Results.connP->hostName; @@ -709,6 +712,7 @@ Print_cm_PerfInfo() afs_int32 numLongs; /*# longwords received */ struct afs_stats_CMPerf *perfP; /*Ptr to performance stats */ char *printableTime; /*Ptr to printable time string */ + time_t probeTime; numLongs = xstat_cm_Results.data.AFSCB_CollData_len; if (numLongs != perfLongs) { @@ -718,7 +722,8 @@ Print_cm_PerfInfo() return; } - printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + probeTime = xstat_cm_Results.probeTime; + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; perfP = (struct afs_stats_CMPerf *) (xstat_cm_Results.data.AFSCB_CollData_val); @@ -935,7 +940,7 @@ Print_cm_FullPerfInfo() static afs_int32 fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2); /*Correct #longs */ afs_int32 numLongs; /*# longs actually received */ struct afs_stats_CMFullPerf *fullP; /*Ptr to full perf info */ - + time_t probeTime; char *printableTime; /*Ptr to printable time string */ numLongs = xstat_cm_Results.data.AFSCB_CollData_len; @@ -947,7 +952,8 @@ Print_cm_FullPerfInfo() return; } - printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + probeTime = xstat_cm_Results.probeTime; + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; fullP = (struct afs_stats_CMFullPerf *) (xstat_cm_Results.data.AFSCB_CollData_val); @@ -1029,6 +1035,7 @@ afsmon_cmOutput(a_outfile, a_detOutput) afs_int32 numLongs; /* longwords in result */ afs_int32 *currLong; /* ptr to longwords in result */ int i; + time_t probeTime; if (afsmon_debug) { fprintf(debugFD, "[ %s ] Called, a_outfile= %s, a_detOutput= %d\n", @@ -1045,7 +1052,8 @@ afsmon_cmOutput(a_outfile, a_detOutput) } /* get the probe time and strip the \n at the end */ - printTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + probeTime = xstat_cm_Results.probeTime; + printTime = ctime(&probeTime); printTime[strlen(printTime) - 1] = '\0'; hostname = xstat_cm_Results.connP->hostName; diff --git a/src/afsmonitor/afsmon-parselog.c b/src/afsmonitor/afsmon-parselog.c index 679f12c..5fc6548 100644 --- a/src/afsmonitor/afsmon-parselog.c +++ b/src/afsmonitor/afsmon-parselog.c @@ -320,7 +320,7 @@ Print_fs_FullPerfInfo(a_fs_Results) long numLongs; /*# longwords received */ struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */ char *printableTime; /*Ptr to printable time string */ - + time_t probeTime; numLongs = a_fs_Results->data.AFS_CollData_len; if (numLongs != fullPerfLongs) { @@ -329,7 +329,8 @@ Print_fs_FullPerfInfo(a_fs_Results) return; } - printableTime = ctime(&(a_fs_Results->probeTime)); + probeTime = a_fs_Results->probeTime; + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; fullPerfP = (struct fs_stats_FullPerfStats *) (a_fs_Results->data.AFS_CollData_val); diff --git a/src/afsweb/apache_afs_weblog.c b/src/afsweb/apache_afs_weblog.c index 8468e05..491ea7f 100644 --- a/src/afsweb/apache_afs_weblog.c +++ b/src/afsweb/apache_afs_weblog.c @@ -91,7 +91,7 @@ get_time() char *time_string; t = time(NULL); - time_string = (char *)ctime((time_t *) & t); + time_string = (char *)ctime(&t); time_string[strlen(time_string) - 1] = '\0'; return (time_string); } diff --git a/src/budb/struct_ops.c b/src/budb/struct_ops.c index 5d6c010..0377f3b 100644 --- a/src/budb/struct_ops.c +++ b/src/budb/struct_ops.c @@ -36,21 +36,22 @@ RCSID * ---------------------------------- */ -printDbHeader(ptr) - struct DbHeader *ptr; +void +printDbHeader(struct DbHeader *ptr) { + time_t created = ptr->created; printf("version = %d\n", ptr->dbversion); - printf("created = %s", ctime((time_t *) & ptr->created)); + printf("created = %s", ctime(&created)); printf("cell = %s\n", ptr->cell); printf("lastDumpId = %u\n", ptr->lastDumpId); printf("lastInstanceId = %d\n", ptr->lastInstanceId); printf("lastTapeId = %d\n", ptr->lastTapeId); } -printDump(fid, dptr) - FILE *fid; - struct dump *dptr; +void +printDump(FILE *fid, struct dump *dptr) { + time_t created = dptr->created; fprintf(fid, "id = %u\n", dptr->id); fprintf(fid, "idHashChain = %d\n", dptr->idHashChain); fprintf(fid, "name = %s\n", dptr->dumpName); @@ -59,7 +60,7 @@ printDump(fid, dptr) fprintf(fid, "nameHashChain = %d\n", dptr->nameHashChain); fprintf(fid, "flags = 0x%x\n", dptr->flags); fprintf(fid, "parent = %u\n", dptr->parent); - fprintf(fid, "created = %s", ctime((time_t *) & dptr->created)); + fprintf(fid, "created = %s", ctime(&created)); fprintf(fid, "nVolumes = %d\n", dptr->nVolumes); /* printTapeSet(&dptr->tapes); */ fprintf(fid, "firstTape = %d\n", dptr->firstTape); @@ -67,9 +68,10 @@ printDump(fid, dptr) } -printDumpEntry(deptr) - struct budb_dumpEntry *deptr; +void +printDumpEntry(struct budb_dumpEntry *deptr) { + time_t created = deptr->created; printf("id = %u\n", deptr->id); printf("Initial id = %u\n", deptr->initialDumpID); printf("Appended id = %u\n", deptr->appendedDumpID); @@ -94,7 +96,7 @@ printDumpEntry(deptr) printf("volumeSet = %s\n", deptr->volumeSetName); printf("dump path = %s\n", deptr->dumpPath); printf("name = %s\n", deptr->name); - printf("created = %s", ctime((time_t *) & deptr->created)); + printf("created = %s", ctime(&created)); printf("nVolumes = %d\n", deptr->nVolumes); printTapeSet(&deptr->tapes, (deptr->flags & BUDB_DUMP_XBSA_NSS)); @@ -156,14 +158,13 @@ printStructDumpHeader(ptr) } int -printTape(fid, tptr) - FILE *fid; - struct tape *tptr; +printTape(FILE *fid, struct tape *tptr) { + time_t written = tptr->written; fprintf(fid, "name = %s\n", tptr->name); fprintf(fid, "nameHashChain = %d\n", tptr->nameHashChain); fprintf(fid, "flags = 0x%x\n", tptr->flags); - fprintf(fid, "written = %s", ctime((time_t *) & tptr->written)); + fprintf(fid, "written = %s", ctime(&written)); fprintf(fid, "nMBytes = %d\n", tptr->nMBytes); fprintf(fid, "nBytes = %d\n", tptr->nBytes); fprintf(fid, "nFiles = %d\n", tptr->nFiles); @@ -178,9 +179,11 @@ printTape(fid, tptr) } int -printTapeEntry(teptr) - struct budb_tapeEntry *teptr; +printTapeEntry(struct budb_tapeEntry *teptr) { + time_t written = teptr->written; + time_t expires = teptr->expires; + printf("name = %s\n", teptr->name); printf("flags = 0x%x", teptr->flags); if (teptr->flags & BUDB_TAPE_TAPEERROR) @@ -196,8 +199,8 @@ printTapeEntry(teptr) if (teptr->flags & BUDB_TAPE_WRITTEN) printf(": Successful"); printf("\n"); - printf("written = %s", ctime((time_t *) & teptr->written)); - printf("expires = %s", cTIME((time_t *) & teptr->expires)); + printf("written = %s", ctime(&written)); + printf("expires = %s", cTIME(&expires)); printf("kBytes Tape Used = %u\n", teptr->useKBytes); printf("nMBytes Data = %d\n", teptr->nMBytes); printf("nBytes Data = %d\n", teptr->nBytes); @@ -227,9 +230,9 @@ printTapeSet(tsptr, nss) } int -printVolumeEntry(veptr) - struct budb_volumeEntry *veptr; +printVolumeEntry(struct budb_volumeEntry *veptr) { + time_t clone = veptr->clone; printf("name = %s\n", veptr->name); printf("flags = 0x%x", veptr->flags); if (veptr->flags & BUDB_VOL_TAPEERROR) @@ -251,7 +254,7 @@ printVolumeEntry(veptr) printf("tapeSeq = %d\n", veptr->tapeSeq); printf("position = %d\n", veptr->position); - printf("clone = %s", ctime((time_t *) & veptr->clone)); + printf("clone = %s", ctime(&clone)); printf("startByte = %d\n", veptr->startByte); printf("nBytes = %d\n", veptr->nBytes); printf("seq = %d\n", veptr->seq); @@ -262,17 +265,17 @@ printVolumeEntry(veptr) } int -printVolFragment(fid, vfptr) - FILE *fid; - struct volFragment *vfptr; +printVolFragment(FILE *fid, struct volFragment *vfptr) { + time_t clone = vfptr->clone; + time_t incTime = vfptr->incTime; fprintf(fid, "vol = %d\n", vfptr->vol); fprintf(fid, "sameNameChain = %d\n", vfptr->sameNameChain); fprintf(fid, "tape = %d\n", vfptr->tape); fprintf(fid, "sameTapeChain = %d\n", vfptr->sameTapeChain); fprintf(fid, "position = %d\n", vfptr->position); - fprintf(fid, "clone = %s", ctime((time_t *) & vfptr->clone)); - fprintf(fid, "incTime = %s", ctime((time_t *) & vfptr->incTime)); + fprintf(fid, "clone = %s", ctime(&clone)); + fprintf(fid, "incTime = %s", ctime(&incTime)); fprintf(fid, "startByte = %d\n", vfptr->startByte); fprintf(fid, "nBytes = %d\n", vfptr->nBytes); fprintf(fid, "flags = %d\n", vfptr->flags); diff --git a/src/kauth/rebuild.c b/src/kauth/rebuild.c index 2d63689..4a892a1 100644 --- a/src/kauth/rebuild.c +++ b/src/kauth/rebuild.c @@ -124,6 +124,9 @@ PrintEntry(index, entry) char Time[100]; struct tm *tm_p; time_t tt; + time_t modification_time = entry->modification_time; + time_t change_password_time = entry->change_password_time; + time_t max_ticket_lifetime = entry->max_ticket_lifetime; printf("\n"); @@ -204,12 +207,12 @@ PrintEntry(index, entry) (!entry->pwsums[0] && !entry->pwsums[1]) ? "yes" : "no"); printf(" Mod Time = %u: %s", entry->modification_time, - ctime((time_t *) & entry->modification_time)); + ctime(&modification_time)); printf(" Mod ID = %u\n", entry->modification_id); printf(" Change Password Time = %u: %s", entry->change_password_time, - ctime((time_t *) & entry->change_password_time)); + ctime(&change_password_time)); printf(" Ticket lifetime = %u: %s", entry->max_ticket_lifetime, - ctime((time_t *) & entry->max_ticket_lifetime)); + ctime(&max_ticket_lifetime)); printf(" Key Version = %d\n", entry->key_version); printf(" Key = "); diff --git a/src/package/update.c b/src/package/update.c index 0e74e09..08136bd 100644 --- a/src/package/update.c +++ b/src/package/update.c @@ -382,8 +382,9 @@ dochtim(CTREEPTR np, char *path) tm[0].tv_usec = tm[1].tv_usec = 0; if (!opt_silent) { char *date; + time_t mtime = np->mtime; - date = ctime((time_t *) & np->mtime); + date = ctime(&mtime); date[24] = 0; loudonly_message("utimes %s [%s]", path, date); } diff --git a/src/tests/dumptool.c b/src/tests/dumptool.c index 9356549..decf80b 100644 --- a/src/tests/dumptool.c +++ b/src/tests/dumptool.c @@ -314,6 +314,7 @@ main(int argc, char *argv[]) struct winsize win; FILE *f; int fd; + time_t tmv; #ifdef RESIDENCY for (i = 0; i < RS_MAXRESIDENCIES; i++) { @@ -486,9 +487,12 @@ main(int argc, char *argv[]) printf(" needsSalvaged"); printf("\n"); printf("\tuniquifier = %lu\n", vol.uniquifier); - printf("\tCreation date = %s", ctime((time_t *) & vol.creationDate)); - printf("\tLast access date = %s", ctime((time_t *) & vol.accessDate)); - printf("\tLast update date = %s", ctime((time_t *) & vol.updateDate)); + tmv = vol.creationDate; + printf("\tCreation date = %s", ctime(&tmv)); + tmv = vol.accessDate; + printf("\tLast access date = %s", ctime(&tmv)); + tmv = vol.updateDate; + printf("\tLast update date = %s", ctime(&tmv)); printf("\tVolume owner = %lu\n", vol.owner); } diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index b627fba..ef5dd1f 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -285,6 +285,7 @@ DisplayRecord(outFilep, alp, rsize) int status; int printed; /* did we print the string yet? */ afs_int32 *tlp; + time_t tmv; /* decode parameters */ temp = alp[0]; /* type encoded in low-order 24 bits, t0 high */ @@ -354,7 +355,8 @@ DisplayRecord(outFilep, alp, rsize) #endif /* AFS_SGI64_ENV */ break; case ICL_TYPE_UNIXDATE: - printfParms[pfpix++] = (long)ctime((time_t *) & alp[pix]); + tmv = alp[pix]; + printfParms[pfpix++] = (long)ctime(&tmv); break; default: printf("DisplayRecord: Bad type %d in decode switch.\n", type); @@ -450,8 +452,9 @@ DisplayRecord(outFilep, alp, rsize) } if (!printed) { if (alp[1] == ICL_INFO_TIMESTAMP) { + tmv = alp[4]; fprintf(outFilep, "time %d.%06d, pid %u: %s\n", alp[3] / 1000000, - alp[3] % 1000000, alp[2], ctime((time_t *) & alp[4])); + alp[3] % 1000000, alp[2], ctime(&tmv)); } else { fprintf(outFilep, "raw op %d, time %d.%06d, pid %u\n", alp[1], alp[3] / 1000000, alp[3] % 1000000, alp[2]); @@ -500,8 +503,9 @@ DisplayRecord(outFilep, alp, rsize) fprintf(outFilep, "p%d:%s ", i, (char *)&alp[pix]); break; case ICL_TYPE_UNIXDATE: + tmv = alp[pix]; fprintf(outFilep, "p%d:%s ", i, - ctime((time_t *) & alp[pix])); + ctime(&tmv)); break; default: printf diff --git a/src/viced/host.c b/src/viced/host.c index 56af963..23f1eed 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -2007,8 +2007,10 @@ h_PrintClient(register struct host *host, int held, StreamHandle_t * file) char tmpStr[256]; char tbuffer[32]; char hoststr[16]; + time_t LastCall, expTime; H_LOCK; + LastCall = host->LastCall; if (host->hostFlags & HOSTDELETED) { H_UNLOCK; return held; @@ -2017,12 +2019,13 @@ h_PrintClient(register struct host *host, int held, StreamHandle_t * file) "Host %s:%d down = %d, LastCall %s", afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), (host->hostFlags & VENUSDOWN), - afs_ctime((time_t *) & host->LastCall, tbuffer, + afs_ctime(&LastCall, tbuffer, sizeof(tbuffer))); (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); for (client = host->FirstClient; client; client = client->next) { if (!client->deleted) { if (client->tcon) { + expTime = client->expTime; (void)afs_snprintf(tmpStr, sizeof tmpStr, " user id=%d, name=%s, sl=%s till %s", client->ViceId, h_UserName(client), @@ -2030,8 +2033,7 @@ h_PrintClient(register struct host *host, int held, StreamHandle_t * file) authClass ? "Authenticated" : "Not authenticated", client-> - authClass ? afs_ctime((time_t *) & client-> - expTime, tbuffer, + authClass ? afs_ctime(&expTime, tbuffer, sizeof(tbuffer)) : "No Limit\n"); (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file); diff --git a/src/vlserver/vlclient.c b/src/vlserver/vlclient.c index 42d70c0..2671730 100644 --- a/src/vlserver/vlclient.c +++ b/src/vlserver/vlclient.c @@ -1323,8 +1323,9 @@ dump_stats(stats, vital_header) { int i; char strg[30]; + time_t start_time = stats->start_time; - strncpy(strg, ctime((time_t *) & stats->start_time), sizeof(strg)); + strncpy(strg, ctime(&start_time), sizeof(strg)); strg[strlen(strg) - 1] = 0; printf("Dynamic statistics stats (starting time: %s):\n", strg); printf("OpcodeName\t# Requests\t# Aborts\n"); diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 2dd5b2a..1a3a9bd 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -2164,11 +2164,13 @@ SalvageIndex(Inode ino, VnodeClass class, int RW, } if (VNDISK_GET_INO(vnode)) { if (!Showmode) { - Log("Vnode %d (unique %u): corresponding inode %s is missing; vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, PrintInode(NULL, VNDISK_GET_INO(vnode)), ctime((time_t *) & (vnode->serverModifyTime))); + time_t serverModifyTime = vnode->serverModifyTime; + Log("Vnode %d (unique %u): corresponding inode %s is missing; vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, PrintInode(NULL, VNDISK_GET_INO(vnode)), ctime(&serverModifyTime)); } } else { if (!Showmode) - Log("Vnode %d (unique %u): bad directory vnode (no inode number listed); vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, ctime((time_t *) & (vnode->serverModifyTime))); + time_t serverModifyTime = vnode->serverModifyTime; + Log("Vnode %d (unique %u): bad directory vnode (no inode number listed); vnode deleted, vnode mod time=%s", vnodeNumber, vnode->uniquifier, ctime(&serverModifyTime)); } memset(vnode, 0, vcp->diskSize); vnodeChanged = 1; diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 331c90b..9064b35 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -3159,6 +3159,7 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 clonetid = 0, onlinetid; afs_int32 fromtid = 0; afs_uint32 fromdate, thisdate; + time_t tmv; int s; manyDests tr; manyResults results; @@ -3586,8 +3587,10 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver, if (fromdate == 0) fprintf(STDOUT, " (full release)"); - else - fprintf(STDOUT, " (as of %.24s)", ctime((time_t *)&fromdate)); + else { + tmv = fromdate; + fprintf(STDOUT, " (as of %.24s)", ctime(&tmv)); + } fprintf(STDOUT, ".\n"); fflush(STDOUT); } @@ -3838,6 +3841,7 @@ UV_DumpVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart, struct rx_call *fromcall = (struct rx_call *)0; afs_int32 fromtid = 0, rxError = 0, rcode = 0; afs_int32 code, error = 0; + time_t tmv = fromdate; if (setjmp(env)) ERROR_EXIT(EPIPE); @@ -3850,7 +3854,7 @@ UV_DumpVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart, VPRINT("Full Dump ...\n"); } else { VPRINT1("Incremental Dump (as of %.24s)...\n", - ctime((time_t *) & fromdate)); + ctime(&tmv)); } /* get connections to the servers */ @@ -3920,6 +3924,7 @@ UV_DumpClonedVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 code = 0, vcode = 0, error = 0; afs_int32 clonevol = 0; char vname[64]; + time_t tmv = fromdate; if (setjmp(env)) ERROR_EXIT(EPIPE); @@ -3932,7 +3937,7 @@ UV_DumpClonedVolume(afs_int32 afromvol, afs_int32 afromserver, VPRINT("Full Dump ...\n"); } else { VPRINT1("Incremental Dump (as of %.24s)...\n", - ctime((time_t *) & fromdate)); + ctime(&tmv)); } /* get connections to the servers */ diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c index 7164906..95fb3bb 100644 --- a/src/xstat/xstat_cm_test.c +++ b/src/xstat/xstat_cm_test.c @@ -132,13 +132,13 @@ PrintCallInfo() int numInt32s; /*# int32words returned */ afs_int32 *currInt32; /*Ptr to current afs_int32 value */ char *printableTime; /*Ptr to printable time string */ - + time_t probeTime = xstat_cm_Results.probeTime; /* * Just print out the results of the particular probe. */ numInt32s = xstat_cm_Results.data.AFSCB_CollData_len; currInt32 = (afs_int32 *) (xstat_cm_Results.data.AFSCB_CollData_val); - printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; printf @@ -163,8 +163,9 @@ print_cmCallStats() static char rn[] = "print_cmCallStats"; /*Routine name */ char *printableTime; /*Ptr to printable time string */ struct afs_CMStats *cmp; + time_t probeTime = xstat_cm_Results.probeTime; - printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; printf @@ -805,6 +806,7 @@ PrintPerfInfo() afs_int32 numInt32s; /*# int32words received */ struct afs_stats_CMPerf *perfP; /*Ptr to performance stats */ char *printableTime; /*Ptr to printable time string */ + time_t probeTime = xstat_cm_Results.probeTime; numInt32s = xstat_cm_Results.data.AFSCB_CollData_len; if (numInt32s != perfInt32s) { @@ -814,7 +816,7 @@ PrintPerfInfo() return; } - printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; perfP = (struct afs_stats_CMPerf *) (xstat_cm_Results.data.AFSCB_CollData_val); @@ -1036,6 +1038,7 @@ PrintFullPerfInfo() struct afs_stats_CMFullPerf *fullP; /*Ptr to full perf info */ char *printableTime; /*Ptr to printable time string */ + time_t probeTime = xstat_cm_Results.probeTime; numInt32s = xstat_cm_Results.data.AFSCB_CollData_len; if (numInt32s != fullPerfInt32s) { @@ -1045,7 +1048,7 @@ PrintFullPerfInfo() return; } - printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; fullP = (struct afs_stats_CMFullPerf *) (xstat_cm_Results.data.AFSCB_CollData_val); diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index b0f1119..e5ac15a 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -122,13 +122,14 @@ PrintCallInfo() int numInt32s; /*# int32words returned */ afs_int32 *currInt32; /*Ptr to current afs_int32 value */ char *printableTime; /*Ptr to printable time string */ + time_t probeTime = xstat_fs_Results.probeTime; /* * Just print out the results of the particular probe. */ numInt32s = xstat_fs_Results.data.AFS_CollData_len; currInt32 = (afs_int32 *) (xstat_fs_Results.data.AFS_CollData_val); - printableTime = ctime((time_t *) & (xstat_fs_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; printf("AFS_XSTATSCOLL_CALL_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n", @@ -422,6 +423,7 @@ PrintFullPerfInfo() struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */ char *printableTime; /*Ptr to printable time * string */ + time_t probeTime = xstat_fs_Results.probeTime; numInt32s = xstat_fs_Results.data.AFS_CollData_len; if (numInt32s != fullPerfInt32s) { @@ -430,7 +432,7 @@ PrintFullPerfInfo() return; } - printableTime = ctime((time_t *) & (xstat_fs_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; fullPerfP = (struct fs_stats_FullPerfStats *) (xstat_fs_Results.data.AFS_CollData_val); @@ -473,6 +475,7 @@ PrintPerfInfo() afs_int32 numInt32s; /*# int32words received */ struct afs_PerfStats *perfP; /*Ptr to performance stats */ char *printableTime; /*Ptr to printable time string */ + time_t probeTime = xstat_fs_Results.probeTime; numInt32s = xstat_fs_Results.data.AFS_CollData_len; if (numInt32s != perfInt32s) { @@ -481,7 +484,7 @@ PrintPerfInfo() return; } - printableTime = ctime((time_t *) & (xstat_fs_Results.probeTime)); + printableTime = ctime(&probeTime); printableTime[strlen(printableTime) - 1] = '\0'; perfP = (struct afs_PerfStats *) (xstat_fs_Results.data.AFS_CollData_val); -- 1.9.4