- int b;
-
- b = bind_portrange(client_socket, &claddr, 512, IPPORT_RESERVED - 1, "tcp");
- if (b == 0) {
- goto out; /* got what we wanted */
- }
- save_errno = errno;
- dbprintf(("%s: %s: bind(IPPORT_RESERVED) failed: %s\n",
- debug_prefix(NULL),
- f,
- strerror(save_errno)));
- aclose(client_socket);
- errno = save_errno;
- return -1;
+#ifdef LOW_TCPPORTRANGE
+ client_socket = connect_portrange(&claddr, LOW_TCPPORTRANGE,
+ "tcp", &svaddr, nonblock);
+#else
+ client_socket = connect_portrange(&claddr, (socklen_t)512,
+ (socklen_t)(IPPORT_RESERVED - 1),
+ "tcp", &svaddr, nonblock);
+#endif
+
+ if (client_socket > 0)
+ goto out;
+
+#ifdef LOW_TCPPORTRANGE
+ dbprintf((
+ "%s: stream_client: Could not bind to port in range %d-%d.\n",
+ debug_prefix(NULL), LOW_TCPPORTRANGE));
+#else
+ dbprintf((
+ "%s: stream_client: Could not bind to port in range 512-%d.\n",
+ debug_prefix(NULL), IPPORT_RESERVED - 1));
+#endif