[23046] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r22709 - trunk/athena/bin/xcluster

daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Sat Jan 26 18:15:42 2008

Date: Sat, 26 Jan 2008 18:15:11 -0500 (EST)
From: ghudson@MIT.EDU
Message-Id: <200801262315.SAA04069@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: ghudson
Date: 2008-01-26 18:15:10 -0500 (Sat, 26 Jan 2008)
New Revision: 22709

Modified:
   trunk/athena/bin/xcluster/net.c
Log:
* athena/xcluster/net.c: Fall back to hardcoded port if getservbyname
  fails.  Patch by broder.


Modified: trunk/athena/bin/xcluster/net.c
===================================================================
--- trunk/athena/bin/xcluster/net.c	2008-01-25 20:55:26 UTC (rev 22708)
+++ trunk/athena/bin/xcluster/net.c	2008-01-26 23:15:10 UTC (rev 22709)
@@ -6,6 +6,8 @@
 #include <netdb.h>
 #include <hesiod.h>
 
+#define CVIEW_FALLBACK_PORT 3704
+
 int net(progname, num, names)
      char *progname;
      int num;
@@ -51,16 +53,11 @@
 	}
 
       sp = getservbyname("cview", "tcp");
-      if (sp == 0) 
-	{
-	  fprintf(stderr, "%s: Unknown service 'tcp/cview'.\n", progname);
-	  return(-1);
-	}
 
       memset(&sin, 0, sizeof (sin));
       memcpy(&sin.sin_addr, hp->h_addr, hp->h_length);
       sin.sin_family = hp->h_addrtype;
-      sin.sin_port = sp->s_port;
+      sin.sin_port = (sp) ? sp->s_port : htons(CVIEW_FALLBACK_PORT);
 
       init = 1;
     }


home help back first fref pref prev next nref lref last post