From 3e59f10fe3e32e6e632b46a1118e8a06c2b722a9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 15 Sep 2011 11:12:15 +0200 Subject: [PATCH] Facility to change working directory for daemon Option -wdir sets working directory to dir. --- doc/pazpar2.xml | 16 +++++++++++++--- src/pazpar2.c | 9 +++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/pazpar2.xml b/doc/pazpar2.xml index 9e346e8..4cbe5f8 100644 --- a/doc/pazpar2.xml +++ b/doc/pazpar2.xml @@ -38,8 +38,9 @@ - + + @@ -167,6 +168,15 @@ + + + + Sets log level (YAZ log level system). + + + + + @@ -178,10 +188,10 @@ - + - Sets log level (YAZ log level system). + Changes working directory to dir. diff --git a/src/pazpar2.c b/src/pazpar2.c index fcbbca2..f51fa9e 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -152,6 +152,14 @@ static int sc_main( break; case 'V': show_version(); + break; + case 'w': + if (chdir(arg)) + { + yaz_log(YLOG_FATAL|YLOG_ERRNO, "chdir %s", arg); + return 1; + } + break; case 'X': global_parameters.debug_mode++; global_parameters.predictable_sessions = 1; @@ -169,6 +177,7 @@ static int sc_main( " -u uid Change user to uid\n" " -V Show version\n" " -v level Set log level\n" + " -w dir Working directory\n" " -X Debug mode\n" #ifdef WIN32 " -install Install windows service\n" -- 1.7.10.4