From 6e860ab817dfe2edc6f6a44ebbcbeef312b8c4a9 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 5 Mar 2001 09:24:51 +0000 Subject: Removed static function GetHostName(), call Util_GetHostName() instead. This fixes problems if gethostbyname() returns NULL. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPDExtra/trunk@26 61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1 --- src/HostNames.c | 49 ++----------------------------------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/src/HostNames.c b/src/HostNames.c index 20e0ce1..3f99ea6 100644 --- a/src/HostNames.c +++ b/src/HostNames.c @@ -10,6 +10,7 @@ #ifndef TEST_HOSTNAMES #include "cctk.h" +#include "util_Network.h" #endif #include @@ -60,7 +61,6 @@ CCTK_FILEVERSION(CactusConnect_HTTPDExtra_HostNames_c) /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ -static void GetHostName(char *name, int length); /******************************************************************** ********************* Other Routine Prototypes ********************* @@ -96,7 +96,7 @@ void HTTPDExtra_CollateHostData(void) int nprocs; char thisdata[HOSTDATALENGTH+1]; - GetHostName(thisdata, HOSTDATALENGTH); + Util_GetHostName(thisdata, HOSTDATALENGTH); thisdata[HOSTDATALENGTH] = 0; @@ -153,51 +153,6 @@ const char *HTTPDExtra_RemoteHostName(int host) ********************* Local Routines ************************* ********************************************************************/ - /*@@ - @routine GetHostName - @date Fri Oct 20 12:12:34 2000 - @author Tom Goodale - @desc - Gets the fully qualified name of this host if possible. - @enddesc - @calls - @calledby - @history - - @endhistory - @var name - @vdesc character buffer to store name in - @vtype char * - @vio out - @vcomment - - @endvar - @var length - @vdesc length of the character buffer - @vtype int - @vio in - @vcomment - - @endvar - -@@*/ -static void GetHostName(char *name, int length) -{ - gethostname(name, length); - - /* Does the name include the domain. */ - if(!strchr(name, '.')) - { -#ifdef HAVE_GETHOSTBYNAME - struct hostent *thishostent; - - thishostent = gethostbyname(name); - - strncpy(name, thishostent->h_name, length); -#endif - } -} - #ifdef TEST_HOSTNAMES int main(int argc, char *argv[]) -- cgit v1.2.3