From 7785e123a4d5b7624e963c6a05614471b7de6073 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 22 Mar 2010 19:58:33 +0100 Subject: [PATCH] amqp plugin: Use "service_name_to_port_number" to parse the "Port" config option. --- src/amqp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) -- 2.30.2