X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=server%2Fstatserv.c;h=3e236bcf406d2c21878cf21589c0b5dab0c1bfdc;hb=929d26653d54a64c12dff06cbb470c22667d79f1;hp=b79948c216c4d6b302e416716127e9f6db27b21f;hpb=e0189c067378b23b5bd64b60c9b2f326f860a66f;p=yaz-moved-to-github.git diff --git a/server/statserv.c b/server/statserv.c index b79948c..3e236bc 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -6,7 +6,7 @@ * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.80 2002-01-28 09:26:42 adam Exp $ + * $Id: statserv.c,v 1.85 2002-09-25 12:37:07 adam Exp $ */ #include @@ -243,7 +243,7 @@ void statserv_closedown() } } -void event_loop_thread (IOCHAN iochan) +void __cdecl event_loop_thread (IOCHAN iochan) { event_loop (&iochan); } @@ -412,7 +412,8 @@ static void listener(IOCHAN h, int event) char dummy[1]; int res; - if ((res = read(hand[0], dummy, 1)) < 0 && errno != EINTR) + if ((res = read(hand[0], dummy, 1)) < 0 && + yaz_errno() != EINTR) { yaz_log(LOG_FATAL|LOG_ERRNO, "handshake read"); return; @@ -601,7 +602,7 @@ static void inetd_connection(int what) /* * Set up a listening endpoint, and give it to the event-handler. */ -static void add_listener(char *where, int what) +static int add_listener(char *where, int what) { COMSTACK l; void *ap; @@ -622,26 +623,27 @@ static void add_listener(char *where, int what) if (!l) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to listen on %s", where); - return; + return -1; } if (cs_bind(l, ap, CS_SERVER) < 0) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to bind to %s", where); cs_close (l); - return; + return -1; } if (!(lst = iochan_create(cs_fileno(l), listener, EVENT_INPUT | EVENT_EXCEPT))) { yaz_log(LOG_FATAL|LOG_ERRNO, "Failed to create IOCHAN-type"); cs_close (l); - return; + return -1; } iochan_setdata(lst, l); /* Ensure our listener chain is setup properly */ lst->next = pListener; pListener = lst; + return 0; /* OK */ } #ifndef WIN32 @@ -751,7 +753,8 @@ int check_options(int argc, char **argv) switch (ret) { case 0: - add_listener(arg, control_block.default_proto); + if (add_listener(arg, control_block.default_proto)) + return 1; /* failed to create listener */ break; case '1': control_block.one_shot = 1; @@ -829,7 +832,7 @@ int check_options(int argc, char **argv) fprintf(stderr, "Usage: %s [ -a -v " " -l -u -c -t " " -k -d " - " -ziST -w ... ]\n", me); + " -ziST1 -w ... ]\n", me); return 1; } } @@ -869,7 +872,7 @@ int statserv_main(int argc, char **argv, /* Now setup the service with the service controller */ SetupService(argc, argv, &ArgDetails, SZAPPNAME, cb->service_name, /* internal service name */ - cb->service_name, /* displayed name of the service */ + cb->service_display_name, /* displayed name */ SZDEPENDENCIES); return 0; }