[BusyBox-cvs] busybox/libbb xconnect.c,1.11,1.12

Glenn McGrath bug1 at busybox.net
Sat Jan 17 05:03:33 UTC 2004


Update of /var/cvs/busybox/libbb
In directory nail:/tmp/cvs-serv356/libbb

Modified Files:
	xconnect.c 
Log Message:
Modify bb_lookup_port to allow the protocol to be specified, allowing 
/etc/services support for inetd, netcat and tftp.


Index: xconnect.c
===================================================================
RCS file: /var/cvs/busybox/libbb/xconnect.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- xconnect.c	23 Dec 2003 20:37:54 -0000	1.11
+++ xconnect.c	17 Jan 2004 05:03:31 -0000	1.12
@@ -23,7 +23,7 @@
  * If "port" is a name it is looked up in /etc/services, if it isnt found return
  * default_port
  */
-unsigned short bb_lookup_port(const char *port, unsigned short default_port)
+unsigned short bb_lookup_port(const char *port, const char *protocol, unsigned short default_port)
 {
 	unsigned short port_nr = htons(default_port);
 	if (port) {
@@ -37,7 +37,7 @@
 		errno = 0;
 		port_long = strtol(port, &endptr, 10);
 		if (errno != 0 || *endptr!='\0' || endptr==port || port_long < 0 || port_long > 65535) {
-			struct servent *tserv = getservbyname(port, "tcp");
+			struct servent *tserv = getservbyname(port, protocol);
 			if (tserv) {
 				port_nr = tserv->s_port;
 			}




More information about the busybox-cvs mailing list