[sheepdog] [PATCH v2] zookeeper: fix bug for default cluster id

yuyanggg at gmail.com yuyanggg at gmail.com
Wed Mar 4 07:11:02 CET 2015


On Wed, Mar 04, 2015 at 11:04:08AM +0800, Yu Yang wrote:
> From: Yu Yang <yuyang at cmss.chinamobile.com>
> 
> Append DEFAULT_BASE to hosts when cluster id is not set.
> 
> Signed-off-by: Yu Yang <yuyang at cmss.chinamobile.com>
> ---
>  sheep/cluster/zookeeper.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/sheep/cluster/zookeeper.c b/sheep/cluster/zookeeper.c
> index 4f85043..47cfa6c 100644
> --- a/sheep/cluster/zookeeper.c
> +++ b/sheep/cluster/zookeeper.c
> @@ -1466,7 +1466,17 @@ static int zk_init(const char *option)
>  
>  sd_info("version %d.%d.%d, address %s, timeout %d", ZOO_MAJOR_VERSION,
>  ZOO_MINOR_VERSION, ZOO_PATCH_VERSION, hosts, zk_timeout);
> - if (zk_connect(hosts, zk_watcher, zk_timeout) < 0)
> + if (!strchr(hosts, '/')) {
> + char *tmp = (char *)malloc((strlen(hosts) +
> + strlen(DEFAULT_BASE) + 1)*sizeof(char));
 
Please use xmalloc() here.
 
Thanks,
Yuan

I find xmalloc() in util.c, but not xfree(), 
then we use free here ?
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20150304/02bb5e59/attachment-0004.html>


More information about the sheepdog mailing list