summaryrefslogtreecommitdiff
path: root/networking/inetd.c
diff options
context:
space:
mode:
authorGlenn L McGrath2004-01-17 05:03:31 +0000
committerGlenn L McGrath2004-01-17 05:03:31 +0000
commit036dbaa082f1974246d1d7d21a8e163559642485 (patch)
tree2488441544ab16f8e08d0955d323019e96ed3d4f /networking/inetd.c
parentb03be7f5677b86acfe2f64b5a57e1f361e257f6c (diff)
downloadbusybox-036dbaa082f1974246d1d7d21a8e163559642485.zip
busybox-036dbaa082f1974246d1d7d21a8e163559642485.tar.gz
Modify bb_lookup_port to allow the protocol to be specified, allowing
/etc/services support for inetd, netcat and tftp.
Diffstat (limited to 'networking/inetd.c')
-rw-r--r--networking/inetd.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/networking/inetd.c b/networking/inetd.c
index d225527..24415fe 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -610,19 +610,13 @@ static void config(int signum)
sep->se_ctrladdr_in.sin_family = AF_INET;
sep->se_ctrladdr_size = sizeof sep->se_ctrladdr_in;
{
- u_short port = htons(atoi(sep->se_service));
-
- if (!port) {
- struct servent *sp;
- sp = getservbyname(sep->se_service,
- sep->se_proto);
- if (sp == 0) {
- syslog(LOG_ERR,
- "%s/%s: unknown service",
- sep->se_service, sep->se_proto);
- continue;
- }
- port = sp->s_port;
+ u_short port = bb_lookup_port(sep->se_service, sep->se_proto, 0);
+
+ if (port == 0) {
+ syslog(LOG_ERR,
+ "%s/%s: unknown service",
+ sep->se_service, sep->se_proto);
+ continue;
}
if (port != sep->se_ctrladdr_in.sin_port) {
sep->se_ctrladdr_in.sin_port = port;