Date: Mon, 02 Aug 1999 23:17:01 +0100 From: Brian Somers <brian@Awfulhak.org> To: Warner Losh <imp@village.org> Cc: Bill Fumerola <billf@jade.chc-chimes.com>, committers@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: Mentioning RFC numbers in /etc/services Message-ID: <199908022217.XAA02577@keep.lan.Awfulhak.org> In-Reply-To: Your message of "Mon, 02 Aug 1999 11:32:15 MDT." <199908021732.LAA07269@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[.....] > @@ -832,15 +833,21 @@ > if (!sep->se_rpc) { > sp = getservbyname(sep->se_service, sep->se_proto); > if (sp == 0) { > + if ((p = strtol(sep->se_service, > + (char **NULL), 10))) { > + sep->se_ctrladdr.sin_port = htons(p); > + goto numeric_override; > + } > syslog(LOG_ERR, "%s/%s: unknown service", > sep->se_service, sep->se_proto); > sep->se_checked = 0; > continue; > } > if (sp->s_port != sep->se_ctrladdr.sin_port) { > + sep->se_ctrladdr.sin_port = sp->s_port; > +numeric_override: > sep->se_ctrladdr.sin_family = AF_INET; > sep->se_ctrladdr.sin_addr = bind_address; > - sep->se_ctrladdr.sin_port = sp->s_port; > if (sep->se_fd >= 0) > close_sep(sep); > } [.....] Yes, but do it the other way 'round - strtol first, if it's not all numeric, getservbyname(). -- Brian <brian@Awfulhak.org> <brian@FreeBSD.org> <http://www.Awfulhak.org> <brian@OpenBSD.org> Don't _EVER_ lose your sense of humour ! <brian@FreeBSD.org.uk> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908022217.XAA02577>