Change interface to bb_lookup_host, dont try and set port inside this
function as there is no gracefull way of handling failures. Rename bb_getport to bb_lookup_port, allow a default port to be specified so it always returns a correct value. Modify ftpgetput/rdate/wget to use the new interface. wget/rdate now use etc/services with a falback default value.
This commit is contained in:
@ -356,7 +356,8 @@ int ftpgetput_main(int argc, char **argv)
|
||||
* and we want to connect to only one IP... */
|
||||
server->s_in = &s_in;
|
||||
server->host = argv[optind];
|
||||
bb_lookup_host(&s_in, server->host, NULL);
|
||||
bb_lookup_host(&s_in, server->host);
|
||||
s_in.sin_port = bb_lookup_port(server->port, 21);
|
||||
if (verbose_flag) {
|
||||
fprintf(stdout, "Connecting to %s[%s]:%s\n",
|
||||
server->host, inet_ntoa(s_in.sin_addr), server->port);
|
||||
|
Reference in New Issue
Block a user