mirror of
https://github.com/gophernicus/gophernicus.git
synced 2024-09-22 04:35:56 -04:00
Allow document roots specified with relative paths
Closes #71 Implements this issue by transforming all relative paths into absolute paths.
This commit is contained in:
parent
430e8f9ee0
commit
7a02ffd8ec
@ -524,8 +524,20 @@ int main(int argc, char *argv[])
|
|||||||
/* Handle command line arguments */
|
/* Handle command line arguments */
|
||||||
parse_args(&st, argc, argv);
|
parse_args(&st, argc, argv);
|
||||||
|
|
||||||
|
/* Initalize logging */
|
||||||
log_init(st.opt_syslog, st.debug);
|
log_init(st.opt_syslog, st.debug);
|
||||||
|
|
||||||
|
/* Convert relative gopher roots to absolute roots */
|
||||||
|
if (st.server_root[0] != '/') {
|
||||||
|
char cwd[512];
|
||||||
|
getcwd(cwd, sizeof(cwd));
|
||||||
|
if (cwd == NULL) {
|
||||||
|
die(&st, NULL, "unable to get current path");
|
||||||
|
}
|
||||||
|
snprintf(buf, sizeof(buf), "%s/%s", cwd, st.server_root);
|
||||||
|
sstrlcpy(st.server_root, buf);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
/* unveil(2) support.
|
/* unveil(2) support.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user