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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
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) {
error:
if (tv) {
+ if (oldtvix == -2) {
+ afs_warn("afs_UFSGetVolSlot: oldvtix is uninitialized\n");
+ return NULL;
+ }
if (oldname) {
tv->name = oldname;
oldname = NULL;