From: Garrett Wollman Date: Sun, 7 Aug 2011 03:49:10 +0000 (-0400) Subject: butc: avoid testing stack garbage; remove dead initializer X-Git-Tag: upstream/1.8.0_pre1^2~3439 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c92f04af6094ce04b1541a1b23b254d3c1421290;p=packages%2Fo%2Fopenafs.git butc: avoid testing stack garbage; remove dead initializer "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. Change-Id: I133f8e84e46d0faedf3c9683330d92158bcd8935 Found-by: clang static analyzer Reviewed-on: http://gerrit.openafs.org/5166 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/butc/tcudbprocs.c b/src/butc/tcudbprocs.c index 296652c78..b4424d86c 100644 --- a/src/butc/tcudbprocs.c +++ b/src/butc/tcudbprocs.c @@ -628,7 +628,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; @@ -643,6 +643,7 @@ saveDbToTape(void *param) afs_pthread_setname_self("Db save"); expires = (saveDbIfPtr->archiveTime ? NEVERDATE : 0); taskId = saveDbIfPtr->taskId; + dumpEntry.id = 0; setStatus(taskId, DRIVE_WAIT); EnterDeviceQueue(deviceLatch); /* lock tape device */