]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Initialize oldvtix
authorMarc Dionne <marc.c.dionne@gmail.com>
Thu, 22 Apr 2010 21:22:37 +0000 (17:22 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 20 May 2010 11:52:00 +0000 (07:52 -0400)
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>
(cherry-picked from commit 0dac8f93af5262472bc5bdf94dbb605a24da59d0)

Change-Id: I3311ad5a73e21f7fb44f9dcf0cda251bae96eb0f
Reviewed-on: http://gerrit.openafs.org/2008
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afs/afs_volume.c

index 007cae9657b5526b339837b84ef41a53c17f36bd..87b32e0d72285107b1d865469a05319cfd483b1c 100644 (file)
@@ -111,7 +111,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) {
@@ -199,6 +199,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;