From 6682fe6295a7bb9fc8c48855efb28383d87f0ca6 Mon Sep 17 00:00:00 2001 From: chris mikkelson Date: Tue, 24 Mar 2009 22:11:38 -0500 Subject: [PATCH] listener spec will typically be a literal string or argv, which we cannot modify in place. strdup() it. --- conn_pool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conn_pool.c b/conn_pool.c index daf10e4..9a4392a 100644 --- a/conn_pool.c +++ b/conn_pool.c @@ -133,11 +133,13 @@ new_listener(char *spec) { int *sock; int one = 1, port = 25; - char *host = spec; - char *t = strchr(spec, ':'); + char *host, *t; struct sockaddr_in l_addr; pthread_t thread; + host = strdup(spec); + t = strchr(host, ':'); + if (t) { *t++ = 0; port = atoi(t); -- 2.50.1