summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_application.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-09-05 10:22:44 -0700
committerMax Romanov <max.romanov@nginx.com>2017-09-05 10:22:44 -0700
commitf1685e371fe8a3bb9442fe2c5e0e33f5da0ac4f9 (patch)
treeed499fb4dabc60c607f6591cafa6520a99d10803 /src/nxt_application.c
parentdb6d2b96877dac089e22817fc9896a45ea410d8d (diff)
downloadunit-f1685e371fe8a3bb9442fe2c5e0e33f5da0ac4f9.tar.gz
unit-f1685e371fe8a3bb9442fe2c5e0e33f5da0ac4f9.tar.bz2
Introducing working_directory directive for applications.
Diffstat (limited to 'src/nxt_application.c')
-rw-r--r--src/nxt_application.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index b887c819..232f5a7e 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -297,6 +297,19 @@ nxt_app_start(nxt_task_t *task, void *data)
nxt_app = nxt_app_module_load(task, lang->file);
}
+ if (app_conf->working_directory != NULL &&
+ app_conf->working_directory[0] != 0)
+ {
+ ret = chdir(app_conf->working_directory);
+
+ if (nxt_slow_path(ret != 0)) {
+ nxt_log(task, NXT_LOG_WARN, "chdir(%s) failed %E",
+ app_conf->working_directory, nxt_errno);
+
+ return NXT_ERROR;
+ }
+ }
+
if (nxt_slow_path(nxt_thread_mutex_create(&nxt_app_mutex) != NXT_OK)) {
return NXT_ERROR;
}