From c92f04af6094ce04b1541a1b23b254d3c1421290 Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Sat, 6 Aug 2011 23:49:10 -0400 Subject: [PATCH] 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 --- src/butc/tcudbprocs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ -- 2.39.5