1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

OpenWRT: Try to create dir for pidfile

This commit is contained in:
winlin 2021-10-03 20:51:07 +08:00
parent 8ea9783de7
commit a19c0fa121
2 changed files with 11 additions and 1 deletions

View file

@ -15,7 +15,7 @@ http_server {
}
vhost __defaultVhost__ {
hls {
enabled on;
enabled off;
}
http_remux {
enabled on;

View file

@ -744,6 +744,8 @@ srs_error_t SrsServer::initialize_signal()
srs_error_t SrsServer::acquire_pid_file()
{
srs_error_t err = srs_success;
// when srs in dolphin mode, no need the pid file.
if (_srs_config->is_dolphin()) {
return srs_success;
@ -751,6 +753,14 @@ srs_error_t SrsServer::acquire_pid_file()
std::string pid_file = _srs_config->get_pid_file();
// Try to create dir for pid file.
string pid_dir = srs_path_dirname(pid_file);
if (!srs_path_exists(pid_dir)) {
if ((err = srs_create_dir_recursively(pid_dir)) != srs_success) {
return srs_error_wrap(err, "create %s", pid_dir.c_str());
}
}
// -rw-r--r--
// 644
int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;