]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
butc: avoid testing stack garbage; remove dead initializer
authorGarrett Wollman <wollman@csail.mit.edu>
Sun, 7 Aug 2011 03:49:10 +0000 (23:49 -0400)
committerDerrick Brashear <shadow@dementia.org>
Fri, 12 Aug 2011 15:51:58 +0000 (08:51 -0700)
"code" is unconditionally set early in saveDbToTape() so there's
no need to initialize it.  On the other hand, dumpEntry.id is used
before dumpEntry is initialized, so set it to what appears to be
the expected value before any non-local exits could cause it to be
inspected.

Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5166
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit c92f04af6094ce04b1541a1b23b254d3c1421290)

Change-Id: If99aaf327749550623ef5abc3dd077f5291bc899
Reviewed-on: http://gerrit.openafs.org/5226
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/butc/tcudbprocs.c

index 6b61a326765754c03666e5522110fca47bda078d..a31652dba8885bfb44cea20f081ec4ec1006b4ec 100644 (file)
@@ -643,7 +643,7 @@ void *
 saveDbToTape(void *param)
 {
     struct saveDbIf *saveDbIfPtr = (struct saveDbIf *)param;
-    afs_int32 code = 0;
+    afs_int32 code;
     afs_int32 i;
     int wroteLabel;
     afs_uint32 taskId;
@@ -657,6 +657,7 @@ saveDbToTape(void *param)
 
     expires = (saveDbIfPtr->archiveTime ? NEVERDATE : 0);
     taskId = saveDbIfPtr->taskId;
+    dumpEntry.id = 0;
 
     setStatus(taskId, DRIVE_WAIT);
     EnterDeviceQueue(deviceLatch);     /* lock tape device */