aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1>2001-03-05 09:24:51 +0000
committertradke <tradke@61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1>2001-03-05 09:24:51 +0000
commit6e860ab817dfe2edc6f6a44ebbcbeef312b8c4a9 (patch)
treecd612e4b205067d49147c37633697d33591a1c1e
parent8f3c764b2dffe32d59ace77b11f765250f9905d3 (diff)
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
-rw-r--r--src/HostNames.c49
1 files 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 <stdio.h>
@@ -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[])