From: Marc Cromme Date: Mon, 23 Apr 2007 08:15:22 +0000 (+0000) Subject: removed some of the most obvious exit() statements, which are now with the dynamic... X-Git-Tag: PAZPAR2.1.0.0~227 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=315af5c601a268e2d0da60477c3470a6c12654c9;p=pazpar2-moved-to-github.git removed some of the most obvious exit() statements, which are now with the dynamic settings system a very easy way to kill the srver: just send a malformed settings file, and it's dead. Still many other exit() needs attention. --- diff --git a/src/http.c b/src/http.c index f4aa55d..40ffbec 100644 --- a/src/http.c +++ b/src/http.c @@ -1,4 +1,4 @@ -/* $Id: http.c,v 1.28 2007-04-19 16:07:20 adam Exp $ +/* $Id: http.c,v 1.29 2007-04-23 08:15:22 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -1004,10 +1004,7 @@ void http_init(const char *addr) strncpy(hostname, addr, len); hostname[len] = '\0'; if (!(he = gethostbyname(hostname))) - { yaz_log(YLOG_FATAL, "Unable to resolve '%s'", hostname); - exit(1); - } memcpy(&myaddr.sin_addr.s_addr, he->h_addr_list[0], he->h_length); port = atoi(pp + 1); diff --git a/src/logic.c b/src/logic.c index bce0ad1..2a0e961 100644 --- a/src/logic.c +++ b/src/logic.c @@ -1,4 +1,4 @@ -/* $Id: logic.c,v 1.18 2007-04-22 16:41:42 adam Exp $ +/* $Id: logic.c,v 1.19 2007-04-23 08:15:22 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -509,8 +509,9 @@ static void add_facet(struct session *s, const char *type, const char *value) if (i == SESSION_MAX_TERMLISTS) { yaz_log(YLOG_FATAL, "Too many termlists"); - exit(1); + return; } + s->termlists[i].name = nmem_strdup(s->nmem, type); s->termlists[i].termlist = termlist_create(s->nmem, s->expected_maxrecs, 15); s->num_termlists = i + 1; @@ -562,7 +563,7 @@ static xmlDoc *normalize_record(struct client *cl, Z_External *rec) yaz_log(YLOG_FATAL, "Unknown native_syntax in normalize_record from %s", db->url); - exit(1); + return 0; } if (global_parameters.dump_records){ @@ -1144,7 +1145,7 @@ static int connection_connect(struct connection *con) if (!(link = cs_create(tcpip_type, 0, PROTO_Z3950))) { yaz_log(YLOG_FATAL|YLOG_ERRNO, "Failed to create comstack"); - exit(1); + return -1; } if (0 == strlen(global_parameters.zproxy_override)){ diff --git a/src/settings.c b/src/settings.c index dcc5996..e6b7c3a 100644 --- a/src/settings.c +++ b/src/settings.c @@ -1,4 +1,4 @@ -/* $Id: settings.c,v 1.18 2007-04-22 15:07:10 adam Exp $ +/* $Id: settings.c,v 1.19 2007-04-23 08:15:22 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -264,10 +264,8 @@ static void prepare_dictionary(struct setting *set) return; if (!strncmp(set->name, "pz:", 3)) // Probably a typo in config fle - { yaz_log(YLOG_FATAL, "Unknown pz: setting '%s'", set->name); - exit(1); - } + // Create a new dictionary entry // Grow dictionary if necessary if (!dictionary->size)