From 2da0f67191a2222daaecab6892082777b77b37f3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 6 May 2005 18:59:35 +0000 Subject: [PATCH] Fixed bug #321: zebra segvs if lock dir does not exist. --- index/zebraapi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/index/zebraapi.c b/index/zebraapi.c index 53ed850..b4283b5 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.164 2005-05-03 09:11:34 adam Exp $ +/* $Id: zebraapi.c,v 1.165 2005-05-06 18:59:35 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -652,6 +652,22 @@ static void zebra_select_register (ZebraHandle zh, const char *new_reg) zh->lock_shadow = zebra_lock_create (res_get(zh->res, "lockDir"), fname, 0); + if (!zh->lock_normal || !zh->lock_shadow) + { + if (zh->lock_normal) + { + zebra_lock_destroy(zh->lock_normal); + zh->lock_normal = 0; + } + if (zh->lock_shadow) + { + zebra_lock_destroy(zh->lock_shadow); + zh->lock_shadow = 0; + } + zebra_close_res(zh); + + return -1; + } } } @@ -697,7 +713,7 @@ int zebra_select_default_database(ZebraHandle zh) const char *group = res_get(zh->service->global_res, "group"); const char *v = res_get_prefix(zh->service->global_res, "database", group, "Default"); - zebra_select_database(zh, v); + return zebra_select_database(zh, v); } return 0; } -- 1.7.10.4