From 2f85823a90fe51cca1d29529998299b03542a40e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 14 Aug 2009 14:35:28 +0200 Subject: [PATCH] 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. --- src/pazpar2.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; -- 1.7.10.4