]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
butc: initialize startTime before it is used
authorGarrett Wollman <wollman@csail.mit.edu>
Sun, 7 Aug 2011 03:36:14 +0000 (23:36 -0400)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Dec 2011 11:03:21 +0000 (03:03 -0800)
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.)

Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5165
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 34cc26a1b11bc8cf8f91996a019ac4b7d21dccd8)

Change-Id: I70e08b61fbc33857da88224a0577330a0d68d9a7
Reviewed-on: http://gerrit.openafs.org/6304
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/butc/lwps.c

index 79690fb9a9b903331f7483d842f74836d1171fa8..337849bbc945e92019ebadac1c0b4e1ebe3ed237 100644 (file)
@@ -1780,6 +1780,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;
@@ -1815,7 +1816,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];