From: Florian Forster Date: Mon, 22 Mar 2010 18:58:33 +0000 (+0100) Subject: amqp plugin: Use "service_name_to_port_number" to parse the "Port" config option. X-Git-Tag: collectd-5.0.0-beta0~28^2~34 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7785e123a4d5b7624e963c6a05614471b7de6073;p=collectd.git amqp plugin: Use "service_name_to_port_number" to parse the "Port" config option. --- diff --git a/src/amqp.c b/src/amqp.c index 23526e2e..95cded7a 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -82,7 +82,17 @@ static int config(const char *key, const char *value) return (config_set(&host, value)); else if(strcasecmp(key, "port") == 0) { - port = atoi(value); + int tmp; + + tmp = service_name_to_port_number (value); + if (tmp <= 0) + { + ERROR ("AMQP plugin: Cannot parse `%s' as a " + "service name (port number).", value); + return (1); + } + + port = tmp; return (0); } else if (strcasecmp(key, "vhost") == 0)