From: Adam Dickmeiss Date: Fri, 14 Aug 2009 12:35:28 +0000 (+0200) Subject: For bad timeout value, use yaz_log and halt Pazpar2 X-Git-Tag: v1.1.0~4 X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;h=2f85823a90fe51cca1d29529998299b03542a40e;p=pazpar2-moved-to-github.git For bad timeout value, use yaz_log and halt Pazpar2 Use yaz_log for errors so they can be spotted in the YAZ log file - like almost all other errors. Do not continue Pazpar2 if bad option is given. --- diff --git a/src/pazpar2.c b/src/pazpar2.c index 671558c..6c8251a 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -98,7 +98,7 @@ static int sc_main( char *arg; const char *pidfile = 0; const char *uid = 0; - int session_timeout = 60; // session timeout + int session_timeout = 60; #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) @@ -139,11 +139,13 @@ static int sc_main( break; case 'T': session_timeout = atoi(arg); - if (session_timeout >= 10 && session_timeout <= 86400) { - global_parameters.session_timeout = session_timeout; - } else { - fprintf(stderr, "Session timeout out of range 10..86400: %d\n", session_timeout); + if (session_timeout < 9 || session_timeout > 86400) + { + yaz_log(YLOG_FATAL, "Session timeout out of range 10..86400: %d", + session_timeout); + return 1; } + global_parameters.session_timeout = session_timeout; break; case 'u': uid = arg;