mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-07 10:38:53 +08:00
nghttpx: Chown log files with --user
This commit is contained in:
15
src/shrpx.cc
15
src/shrpx.cc
@@ -1324,6 +1324,21 @@ int main(int argc, char **argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(get_config()->uid != 0) {
|
||||||
|
if(fchown(worker_config.accesslog_fd,
|
||||||
|
get_config()->uid, get_config()->gid) == -1) {
|
||||||
|
auto error = errno;
|
||||||
|
LOG(WARNING) << "Changing owner of access log file failed: "
|
||||||
|
<< strerror(error);
|
||||||
|
}
|
||||||
|
if(fchown(worker_config.errorlog_fd,
|
||||||
|
get_config()->uid, get_config()->gid) == -1) {
|
||||||
|
auto error = errno;
|
||||||
|
LOG(WARNING) << "Changing owner of error log file failed: "
|
||||||
|
<< strerror(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(get_config()->npn_list.empty()) {
|
if(get_config()->npn_list.empty()) {
|
||||||
mod_config()->npn_list = parse_config_str_list(DEFAULT_NPN_LIST);
|
mod_config()->npn_list = parse_config_str_list(DEFAULT_NPN_LIST);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user