[OpenAFS-devel] [PATCH] add missing #include afsutil.h, fix crashes in cmdebug, xstat_{cm,fs}_test

Christopher Allen Wing wingc@engin.umich.edu
Wed, 21 Jun 2006 17:55:53 -0400 (EDT)


[ this message is Bcc:ed to openafs-bugs ]

When cmdebug, xstat_cm_test, and xstat_fs_test were updated to use the 
afs_inet_ntoa(), afs_inet_ntoa_r() functions, in these CVS deltas:

 	make-cmdebug-addrs-portable-20021007
 	windows-xstat-20060304

the necessary header include was not added:

 	#include <afs/afsutil.h>


Therefore, these functions were being used without a prototype.  On AMD64 
Linux, this results in a crash because the calling convention is 
incorrect.

For instance, the following will crash:

 	cmdebug -addrs
 	xstat_cm_test -debug
 	xstat_fs_test -debug


The included patch adds the necessary includes, and fixes this bug.


Thanks,

Chris Wing
wingc@engin.umich.edu




diff -uNr openafs-1.4.2-beta1.orig/src/venus/cmdebug.c openafs-1.4.2-beta1/src/venus/cmdebug.c
--- openafs-1.4.2-beta1.orig/src/venus/cmdebug.c	2006-03-23 11:45:53.000000000 -0500
+++ openafs-1.4.2-beta1/src/venus/cmdebug.c	2006-06-21 11:51:19.000000000 -0400
@@ -41,6 +41,7 @@
  #include <rx/rx.h>
  #include <lock.h>
  #include <afs/afs_args.h>
+#include <afs/afsutil.h>

  extern struct hostent *hostutil_GetHostByName();

diff -uNr openafs-1.4.2-beta1.orig/src/xstat/xstat_cm.c openafs-1.4.2-beta1/src/xstat/xstat_cm.c
--- openafs-1.4.2-beta1.orig/src/xstat/xstat_cm.c	2006-03-05 22:16:41.000000000 -0500
+++ openafs-1.4.2-beta1/src/xstat/xstat_cm.c	2006-06-21 11:51:52.000000000 -0400
@@ -23,6 +23,8 @@
  #include "xstat_cm.h"		/*Interface for this module */
  #include <lwp.h>		/*Lightweight process package */

+#include <afs/afsutil.h>
+
  #ifdef HAVE_STRING_H
  #include <string.h>
  #else
diff -uNr openafs-1.4.2-beta1.orig/src/xstat/xstat_fs.c openafs-1.4.2-beta1/src/xstat/xstat_fs.c
--- openafs-1.4.2-beta1.orig/src/xstat/xstat_fs.c	2006-03-05 22:16:41.000000000 -0500
+++ openafs-1.4.2-beta1/src/xstat/xstat_fs.c	2006-06-21 11:52:46.000000000 -0400
@@ -23,6 +23,8 @@
  #include "xstat_fs.h"		/*Interface for this module */
  #include <lwp.h>		/*Lightweight process package */

+#include <afs/afsutil.h>
+
  #ifdef HAVE_STRING_H
  #include <string.h>
  #else