mirror of
https://github.com/gophernicus/gophernicus.git
synced 2025-02-02 15:08:00 -05: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 */
|
||||
parse_args(&st, argc, argv);
|
||||
|
||||
/* Initalize logging */
|
||||
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__
|
||||
/* unveil(2) support.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user