mirror of
https://github.com/kakwa/uts-server
synced 2025-07-04 20:47:09 +02:00
passing the launch working dir to the configuration handler
as many configuration paths can be relative to the execution working directory, this directory is recorded at launch time, and the set_params function does a chdir(<start work dir>); <load conf>; chdir("/") when it's called.
This commit is contained in:
parent
d91fbe377e
commit
d6a7ba86ff
5 changed files with 23 additions and 12 deletions
|
@ -217,11 +217,13 @@ static CONF *load_config_file(rfc3161_context *ct, const char *filename) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int set_params(rfc3161_context *ct, char *conf_file) {
|
||||
int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
||||
int ret = 0;
|
||||
CONF *conf = load_config_file(ct, conf_file);
|
||||
ret = 1;
|
||||
int http_counter = 0;
|
||||
|
||||
chdir(conf_wd);
|
||||
// first pass to set the loglevel as soon as possible
|
||||
for (int i = 0; i < RFC3161_OPTIONS_LEN; i++) {
|
||||
int type = rfc3161_options[i].type;
|
||||
|
@ -277,8 +279,10 @@ int set_params(rfc3161_context *ct, char *conf_file) {
|
|||
ct->ts_ctx = create_tsctx(ct, conf, NULL, NULL);
|
||||
if (ct->ts_ctx == NULL)
|
||||
ret = 0;
|
||||
chdir("/");
|
||||
return ret;
|
||||
|
||||
end:
|
||||
chdir("/");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue