Github user ted-ross commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/284#discussion_r184177949
--- Diff: src/amqp.c ---
@@ -73,11 +76,24 @@ const char * const QD_AMQP_COND_FRAME_SIZE_TOO_SMALL =
"amqp:frame-size-too-smal
const char * const QD_AMQP_PORT_STR = "5672";
const char * const QD_AMQPS_PORT_STR = "5671";
+const char * const QD_AMQP_DFLT_PROTO = "tcp";
+
int qd_port_int(const char* port_str) {
if (!strcmp(port_str, QD_AMQP_PORT_STR)) return QD_AMQP_PORT_INT;
if (!strcmp(port_str, QD_AMQPS_PORT_STR)) return QD_AMQPS_PORT_INT;
errno = 0;
unsigned long n = strtoul(port_str, NULL, 10);
if (errno || n > 0xFFFF) return -1;
+
+ // Port is not an integer (port = 'amqp' or 'amqps')
+ if ( !n && strlen(port_str) > 0 ) {
+ // Resolve service port
+ struct servent *serv_info = getservbyname(port_str,
QD_AMQP_DFLT_PROTO);
--- End diff --
The man page for getservbyname states that this call is
multi-thread-unsafe. This should be replaced by a thread-safe equivalent to
avoid concurrency issues.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]