fix: remove unnecessary changes. Reorganise gethostname stuff so it can be debugged. fix
authortimothy.murphy@nokia.com
Mon, 01 Mar 2010 00:54:27 +0200
branchfix
changeset 283 a5284ec02d61
parent 282 99ac65572b14
child 284 2c24e0d7a5d4
fix: remove unnecessary changes. Reorganise gethostname stuff so it can be debugged.
sbsv2/raptor/lib/flm/taggedrules.mk
sbsv2/raptor/util/talon/talon.c
--- a/sbsv2/raptor/lib/flm/taggedrules.mk	Sun Feb 28 22:37:15 2010 +0000
+++ b/sbsv2/raptor/lib/flm/taggedrules.mk	Mon Mar 01 00:54:27 2010 +0200
@@ -100,12 +100,11 @@
 
 else
 
-TALON_HOSTNAME_VAR:=$$HOSTNAME
 
 TALON_RECIPEATTRIBUTES:=\
  name='$$RECIPE'\
  target='$$TARGET'\
- host='$(TALON_HOSTNAME_VAR)'\
+ host='$$HOSTNAME'\
  layer='$$COMPONENT_LAYER'\
  component='$$COMPONENT_NAME'\
  bldinf='$$COMPONENT_META' mmp='$$PROJECT_META'\
--- a/sbsv2/raptor/util/talon/talon.c	Sun Feb 28 22:37:15 2010 +0000
+++ b/sbsv2/raptor/util/talon/talon.c	Mon Mar 01 00:54:27 2010 +0200
@@ -137,7 +137,7 @@
 				att++;
 			} while ( e < (VARNAMEMAX-1) && (isalnum(*att) || *att == '_'));
 			envvarname[e] = '\0';
-/* DEBUG(("envvarname: %s\n", envvarname)); */
+			/* DEBUG(("envvarname: %s\n", envvarname));*/ 
 			v = talon_getenv(envvarname);
 			if (v)
 			{
@@ -344,15 +344,6 @@
 		recipe++;
 
 
-	/* Make sure that the agent's hostname can be put into the host attribute */
-	char hostname[HOSTNAME_MAX];
-
-	if (0 != gethostname(hostname, HOSTNAME_MAX-1))
-	{
-		hostname[0] = '\0';
-	}
-
-	talon_setenv("HOSTNAME", hostname);
 
 
 	/* turn debugging on? */
@@ -366,6 +357,21 @@
 
 	DEBUG(("talon: recipe: %s\n", recipe));
 
+	/* Make sure that the agent's hostname can be put into the host attribute */
+	char hostname[HOSTNAME_MAX];
+	int hostresult=0;
+
+	
+	hostresult = gethostname(hostname, HOSTNAME_MAX-1);
+	if (0 != hostresult)
+	{
+		DEBUG(("talon: failed to get hostname: %d\n", hostresult));
+		hostname[0] = '\0';
+	}
+
+	talon_setenv("HOSTNAME", hostname);
+	DEBUG(("talon: setenv: hostname: %s\n", hostname));
+
 	
 	char varname[VARNAMEMAX];
 	char varval[VARVALMAX];