From 895287495fcae8c8f496a398384ce40576f81acd Mon Sep 17 00:00:00 2001 From: Paul Sadauskas Date: Sat, 20 Jun 2009 15:38:28 -0600 Subject: [PATCH] Fix a bug with recording of port Port was getting written to plugin_instance as "1978.00000", because apparently that's the value returned by the config. --- src/tokyotyrant.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/tokyotyrant.c b/src/tokyotyrant.c index 73a065e1..b59315cb 100644 --- a/src/tokyotyrant.c +++ b/src/tokyotyrant.c @@ -34,10 +34,8 @@ static const char *config_keys[] = static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); static char *host = NULL; - -/* int is for opening connection, string is for plugin_instance */ -static char *port_str = NULL; static int port; +static char port_str[5]; static int tt_config (const char *key, const char *value) { @@ -49,17 +47,13 @@ static int tt_config (const char *key, const char *value) } else if (strcasecmp ("Port", key) == 0) { - if (port_str != NULL) - free (port_str); - port_str = strdup(value); - port = atoi(value); - if ((port < 0) || (port > 65535)) { ERROR ("tokyotyrant plugin: error: Port %s out of range", value); return (-1); } + ssnprintf(port_str, 5, "%i", port); } else { -- 2.30.2