Commit ab4f6392 authored by Steven Murray's avatar Steven Murray Committed by Steven Murray
Browse files

bug #104330: rmcd listening port should not be the result of getservbyname()

Fixed in the trunk ready for the version 2.1.15.x release of CASTOR.
parent fa40c96f
......@@ -62,7 +62,6 @@ int rmc_main(const char *const robot)
char sense[MAXSENSE];
struct sockaddr_in sin;
struct smc_status smc_status;
struct servent *sp;
struct timeval timeval;
char func[16];
......@@ -149,8 +148,6 @@ int rmc_main(const char *const robot)
const char *p;
if ((p = getenv ("RMC_PORT")) || (p = getconfent ("RMC", "PORT", 0))) {
sin.sin_port = htons ((unsigned short)atoi (p));
} else if ((sp = getservbyname ("rmc", "tcp"))) {
sin.sin_port = sp->s_port;
} else {
sin.sin_port = htons ((unsigned short)RMC_PORT);
}
......
......@@ -41,15 +41,11 @@ int send2rmc(
char rmchost[CA_MAXHOSTNAMELEN+1];
int s;
struct sockaddr_in sin; /* internet socket */
struct servent *sp;
strncpy (func, "send2rmc", 16);
sin.sin_family = AF_INET;
if ((p = getenv ("RMC_PORT")) || (p = getconfent ("RMC", "PORT", 0))) {
sin.sin_port = htons ((unsigned short)atoi (p));
} else if ((sp = Cgetservbyname ("rmc", "tcp"))) {
sin.sin_port = sp->s_port;
serrno = 0;
} else {
sin.sin_port = htons ((unsigned short)RMC_PORT);
serrno = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment