From 0dac8f93af5262472bc5bdf94dbb605a24da59d0 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Thu, 22 Apr 2010 17:22:37 -0400 Subject: [PATCH] Initialize oldvtix Initialize the variable to avoid compiler complaints that it could be used uninitialized. Use a sentinel value and issue a warning if we try to use the variable and we haven't set it to a useful value. Change-Id: I037be2ad8e0b55d06b50aafdeca5012764640f16 Reviewed-on: http://gerrit.openafs.org/1810 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/afs_volume.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index cdfe174fa..4548abdf6 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -119,7 +119,7 @@ afs_UFSGetVolSlot(void) afs_int32 bestTime; struct volume *bestVp, *oldLp = NULL, **bestLp = NULL; char *oldname = NULL; - afs_int32 oldvtix; + afs_int32 oldvtix = -2; /* Initialize to a value that doesn't occur */ AFS_STATCNT(afs_UFSGetVolSlot); if (!afs_freeVolList) { @@ -207,6 +207,10 @@ afs_UFSGetVolSlot(void) error: if (tv) { + if (oldtvix == -2) { + afs_warn("afs_UFSGetVolSlot: oldvtix is uninitialized\n"); + return NULL; + } if (oldname) { tv->name = oldname; oldname = NULL; -- 2.39.5