/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2009 Index Data
* See the file LICENSE for details.
*/
#include <yaz/comstack.h>
#include <yaz/tcpip.h>
#include <yaz/options.h>
+#include <yaz/errno.h>
#ifdef USE_XTIMOSI
#include <yaz/xmosi.h>
#endif
}
#endif
+#if YAZ_HAVE_XML2
static struct gfs_server * gfs_server_new(void)
{
struct gfs_server *n = (struct gfs_server *)
n->directory = 0;
n->docpath = 0;
n->stylesheet = 0;
-#if YAZ_HAVE_XML2
n->retrieval = yaz_retrieval_create();
-#endif
return n;
}
+#endif
+#if YAZ_HAVE_XML2
static struct gfs_listen * gfs_listen_new(const char *id,
const char *address)
{
n->address = nmem_strdup(gfs_nmem, address);
return n;
}
+#endif
static void gfs_server_chdir(struct gfs_server *gfs)
{
return 1;
}
+#if YAZ_HAVE_XML2
static void xml_config_read(void)
{
struct gfs_server **gfsp = &gfs_server_list;
struct gfs_listen **gfslp = &gfs_listen_list;
-#if YAZ_HAVE_XML2
xmlNodePtr ptr = xml_config_get_root();
if (!ptr)
gfsp = &(*gfsp)->next;
}
}
-#endif
*gfsp = 0;
}
+#endif
static void xml_config_open(void)
{
static void *new_session(void *vp)
{
- char *a;
+ const char *a;
association *newas;
IOCHAN new_chan;
COMSTACK new_line = (COMSTACK) vp;
#else
a = 0;
#endif
+ yaz_log_xml_errors(0, YLOG_WARN);
yaz_log(log_session, "Session - OK %d %s %ld",
no_sessions, a ? a : "[Unknown]", (long) getpid());
if (max_sessions && no_sessions >= max_sessions)
COMSTACK line;
IOCHAN chan;
association *assoc;
- char *addr;
+ const char *addr;
if ((line = cs_createbysocket(0, tcpip_type, 0, what)))
{
void statserv_setcontrol(statserv_options_block *block)
{
- chdir(gfs_root_dir);
+ if (gfs_root_dir[0])
+ {
+ if (chdir(gfs_root_dir))
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "chdir %s", gfs_root_dir);
+ }
#ifdef WIN32
if (init_control_tls)
TlsSetValue(current_control_tls, block);
close(1);
close(2);
open("/dev/null", O_RDWR);
- dup(0); dup(0);
+ if (dup(0) == -1)
+ return 1;
+ if (dup(0) == -1)
+ return 1;
}
xml_config_add_listeners();
yaz_log_init_level(yaz_log_mask_str(STAT_DEFAULT_LOG_LEVEL));
- yaz_log_xml_errors(0, YLOG_WARN);
get_logbits(1);
while ((ret = options("1a:iszSTl:v:u:c:w:t:k:d:A:p:DC:f:m:r:",
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab