From: Garrett Wollman Date: Sun, 7 Aug 2011 03:36:14 +0000 (-0400) Subject: butc: initialize startTime before it is used X-Git-Tag: upstream/1.8.0_pre1^2~3440 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=34cc26a1b11bc8cf8f91996a019ac4b7d21dccd8;p=packages%2Fo%2Fopenafs.git butc: initialize startTime before it is used In some unusual error situations, startTime may be used uninitialized. Move the initialization up above the first such error condition. (None of the intervening code can take measurably long to execute so this should not make any difference in the non-error case.) Change-Id: I25bf7a5e149540593febec79f9f5111434807514 Found-by: clang static analyzer Reviewed-on: http://gerrit.openafs.org/5165 Tested-by: BuildBot Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear --- diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 1d80c9b1a..f479b78ab 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -1647,6 +1647,7 @@ Restorer(void *param) { printf("\n\n"); TLog(taskId, "Restore\n"); + startTime = time(0); memset(&tapeInfo, 0, sizeof(tapeInfo)); if (!CONF_XBSA) { tapeInfo.structVersion = BUTM_MAJORVERSION; @@ -1682,7 +1683,6 @@ Restorer(void *param) { ERROR_EXIT(TC_NOMEMORY); memset(bufferBlock, 0, allocbufferSize); - startTime = time(0); for (rparams.frag = 0; (rparams.frag < newNode->arraySize); rparams.frag++) { RestoreDesc = &Restore[rparams.frag];