[OpenAFS-devel] [PATCH] functions that sometimes return a value, sometimes don't

Joe Buehler jbuehler@hekimian.com
Fri, 14 Nov 2003 08:50:55 -0500


This patch fixes some functions that sometimes return values,
sometimes don't.

+ cvs diff -u ./src/WINNT/afsd/fs.c
Index: ./src/WINNT/afsd/fs.c
===================================================================
RCS file: /cvs/openafs/src/WINNT/afsd/fs.c,v
retrieving revision 1.5
diff -u -r1.5 fs.c
--- ./src/WINNT/afsd/fs.c	10 Nov 2001 22:31:09 -0000	1.5
+++ ./src/WINNT/afsd/fs.c	13 Nov 2003 21:54:16 -0000
@@ -2099,6 +2099,7 @@
  	    }
  	}
      }
+    return(0);
  }


+ cvs diff -u ./src/bucoord/bc_status.c
Index: ./src/bucoord/bc_status.c
===================================================================
RCS file: /cvs/openafs/src/bucoord/bc_status.c,v
retrieving revision 1.9
diff -u -r1.9 bc_status.c
--- ./src/bucoord/bc_status.c	15 Jul 2003 23:14:46 -0000	1.9
+++ ./src/bucoord/bc_status.c	13 Nov 2003 21:54:17 -0000
@@ -103,6 +103,7 @@

  char *cmdLine;

+int
  cmdDispatch()
  {
  #define	MAXV	100
@@ -127,6 +128,7 @@
       */
      doDispatch(targc, targv, 1);
      cmd_FreeArgv(targv);
+	return(0);
  }

  statusWatcher()
+ cvs diff -u ./src/bucoord/dlq.c
Index: ./src/bucoord/dlq.c
===================================================================
RCS file: /cvs/openafs/src/bucoord/dlq.c,v
retrieving revision 1.6
diff -u -r1.6 dlq.c
--- ./src/bucoord/dlq.c	15 Jul 2003 23:14:47 -0000	1.6
+++ ./src/bucoord/dlq.c	13 Nov 2003 21:54:18 -0000
@@ -89,6 +89,7 @@
   *	move all the items on the fromptr and append to the toptr's list
   */

+void
  dlqMoveb(fromptr, toptr)
       dlqlinkP fromptr;
       dlqlinkP toptr;
@@ -99,7 +100,7 @@
      DLQ_ASSERT_HEAD(toptr);

      if (dlqEmpty(fromptr))
-	return (0);
+	return;

      tailptr = toptr->dlq_prev;

+ cvs diff -u ./src/volser/vos.c
Index: ./src/volser/vos.c
===================================================================
RCS file: /cvs/openafs/src/volser/vos.c,v
retrieving revision 1.30
diff -u -r1.30 vos.c
--- ./src/volser/vos.c	12 Nov 2003 16:07:28 -0000	1.30
+++ ./src/volser/vos.c	13 Nov 2003 21:54:20 -0000
@@ -3477,6 +3477,10 @@
  	*part = rentry->serverPartition[index];
  	return 0;
      }
+    fprintf(STDERR,
+	    "unexpected volume type for volume %lu\n",
+	    (unsigned long)volid);
+    return -1;
  }

  static
+ cvs diff -u ./src/budb/db_hash.c
Index: ./src/budb/db_hash.c
===================================================================
RCS file: /cvs/openafs/src/budb/db_hash.c,v
retrieving revision 1.7
diff -u -r1.7 db_hash.c
--- ./src/budb/db_hash.c	15 Jul 2003 23:14:48 -0000	1.7
+++ ./src/budb/db_hash.c	13 Nov 2003 21:54:21 -0000
@@ -671,6 +671,8 @@
      default:
  	db_panic("illegal hash function");
      }
+	/* not reached, but compiler doesn't know that */
+	return 0;
  }

  /* ht_LookupEntry
+ cvs diff -u ./src/kauth/kaauxdb.c
Index: ./src/kauth/kaauxdb.c
===================================================================
RCS file: /cvs/openafs/src/kauth/kaauxdb.c,v
retrieving revision 1.8
diff -u -r1.8 kaauxdb.c
--- ./src/kauth/kaauxdb.c	15 Jul 2003 23:15:16 -0000	1.8
+++ ./src/kauth/kaauxdb.c	13 Nov 2003 21:54:21 -0000
@@ -131,6 +131,7 @@
  	|| (write(fd, &lasttime, sizeof(afs_int32)) != sizeof(afs_int32)))
  	perror("kaux_write()");

+	return 0;
  }


+ cvs diff -u ./src/kauth/kaserver.c
Index: ./src/kauth/kaserver.c
===================================================================
RCS file: /cvs/openafs/src/kauth/kaserver.c,v
retrieving revision 1.15
diff -u -r1.15 kaserver.c
--- ./src/kauth/kaserver.c	15 Jul 2003 23:15:16 -0000	1.15
+++ ./src/kauth/kaserver.c	13 Nov 2003 21:54:22 -0000
@@ -427,4 +427,5 @@

      ViceLog(0, ("Starting to process AuthServer requests\n"));
      rx_ServerProc();		/* donate this LWP */
+	return 0;
  }
+ cvs diff -u ./src/ptserver/testpt.c
Index: ./src/ptserver/testpt.c
===================================================================
RCS file: /cvs/openafs/src/ptserver/testpt.c,v
retrieving revision 1.11
diff -u -r1.11 testpt.c
--- ./src/ptserver/testpt.c	15 Jul 2003 23:16:03 -0000	1.11
+++ ./src/ptserver/testpt.c	13 Nov 2003 21:54:23 -0000
@@ -191,12 +191,13 @@
       afs_int32 *a;
       afs_int32 *b;
  {
-    if (*a > *b)
-	return 1;
-    if (*a == *b)
-	return 0;
-    if (*a < *b)
-	return -1;
+    if (*a > *b) {
+		return 1;
+    } else if (*a == *b) {
+		return 0;
+    } else {
+		return -1;
+	}
  }

  static int
@@ -240,6 +241,7 @@
      return y;
  }

+void
  CreateUser(u)
       int u;
  {
@@ -276,9 +278,9 @@
  	ownerUser = id;
  	strcpy(ownerUserName, name);
      }
-    return;
  }

+void
  CreateGroup(g)
       int g;
  {
@@ -345,7 +347,6 @@
  	lastGroup = id;
  	lastGroupPrefix = ownerName;
      }
-    return;
  }

  int
@@ -377,6 +378,7 @@
      return -1;			/* none left */
  }

+void
  AddUser(u, g)
       int u, g;
  {
@@ -398,9 +400,9 @@
  	printf("Adding user (%di) to group (%di)\n", ui, gi);
      population[u * number + g]++;
      nAdds++;
-    return;
  }

+void
  RemUser(u, g)
       int u, g;
  {
@@ -418,7 +420,6 @@
  	printf("Removing user (%di) from group (%di)\n", ui, gi);
      population[u * number + g]--;
      nRems++;
-    return;
  }

  TestManyMembers(as, arock)
@@ -765,6 +766,7 @@
  	}
      }
      *ascii = 0;			/* terminate string */
+	return 0;
  }

  /* This runs various tests on the server.  It creates, then deletes, a bunch of
+ cvs diff -u ./src/ptserver/pts.c
Index: ./src/ptserver/pts.c
===================================================================
RCS file: /cvs/openafs/src/ptserver/pts.c,v
retrieving revision 1.10
diff -u -r1.10 pts.c
--- ./src/ptserver/pts.c	15 Jul 2003 23:16:02 -0000	1.10
+++ ./src/ptserver/pts.c	13 Nov 2003 21:54:24 -0000
@@ -195,7 +195,7 @@
  {
  #if defined(SUPERGROUPS)
      if (as && !strcmp(as->name, "help"))
-	return;
+	return 0;
      if (pruclient) {
  	/* Need to shutdown the ubik_client & other connections */
  	pr_End();
@@ -203,7 +203,7 @@
      }
  #else
      if (!strcmp(as->name, "help"))
-	return;
+	return 0;
      /* Need to shutdown the ubik_client & other connections */
      pr_End();
      rx_Finalize();
+ cvs diff -u ./src/ptserver/utils.c
Index: ./src/ptserver/utils.c
===================================================================
RCS file: /cvs/openafs/src/ptserver/utils.c,v
retrieving revision 1.13
diff -u -r1.13 utils.c
--- ./src/ptserver/utils.c	8 Aug 2003 21:54:45 -0000	1.13
+++ ./src/ptserver/utils.c	13 Nov 2003 21:54:25 -0000
@@ -482,12 +482,13 @@
       afs_int32 *b;
  {
      /* used to sort CPS's so that comparison with acl's is easier */
-    if (*a > *b)
-	return 1;
-    if (*a == *b)
-	return 0;
-    if (*a < *b)
-	return -1;
+    if (*a > *b) {
+		return 1;
+    } else if (*a == *b) {
+		return 0;
+    } else {
+		return -1;
+	}
  }

  afs_int32
+ cvs diff -u ./src/ubik/lock.c
Index: ./src/ubik/lock.c
===================================================================
RCS file: /cvs/openafs/src/ubik/lock.c,v
retrieving revision 1.10
diff -u -r1.10 lock.c
--- ./src/ubik/lock.c	8 Aug 2003 20:18:13 -0000	1.10
+++ ./src/ubik/lock.c	13 Nov 2003 21:54:26 -0000
@@ -145,12 +145,12 @@
  }

  /* Release the transaction lock */
-int
+void
  ulock_relLock(atrans)
       struct ubik_trans *atrans;
  {
      if (rwlockinit)
-	return EINVAL;
+	return;

      if (atrans->locktype == LOCKREAD) {
  	ReleaseReadLock(&rwlock);

-- 
Joe Buehler