1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00

Fix #1592, fix terminal echo off by redirect process stdin. 3.0.115

This commit is contained in:
winlin 2020-02-05 13:04:00 +08:00
parent c50c51889a
commit c6d914bc13
5 changed files with 18 additions and 13 deletions

View file

@ -146,6 +146,7 @@ For previous versions, please read:
## V3 changes ## V3 changes
* v3.0, 2020-02-05, For [#1592][bug #1592], fix terminal echo off by redirect process stdin. 3.0.115
* v3.0, 2020-02-04, For [#1186][bug #1186], refactor security check. 3.0.114 * v3.0, 2020-02-04, For [#1186][bug #1186], refactor security check. 3.0.114
* v3.0, 2020-02-04, Fix [#939][bug #939], response right A/V flag in FLV header. 3.0.113 * v3.0, 2020-02-04, Fix [#939][bug #939], response right A/V flag in FLV header. 3.0.113
* v3.0, 2020-02-04, For [#939][bug #939], always enable fast FLV streaming. * v3.0, 2020-02-04, For [#939][bug #939], always enable fast FLV streaming.
@ -1642,6 +1643,7 @@ Winlin
[bug #1206]: https://github.com/ossrs/srs/issues/1206 [bug #1206]: https://github.com/ossrs/srs/issues/1206
[bug #939]: https://github.com/ossrs/srs/issues/939 [bug #939]: https://github.com/ossrs/srs/issues/939
[bug #1186]: https://github.com/ossrs/srs/issues/1186 [bug #1186]: https://github.com/ossrs/srs/issues/1186
[bug #1592]: https://github.com/ossrs/srs/issues/1592
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx
[exo #828]: https://github.com/google/ExoPlayer/pull/828 [exo #828]: https://github.com/google/ExoPlayer/pull/828

View file

@ -27,7 +27,7 @@ ff_log_dir ./objs;
# the log level for FFMPEG. # the log level for FFMPEG.
# info warning error fatal panic quiet # info warning error fatal panic quiet
# trace debug verbose # trace debug verbose
# default: warning # default: info
ff_log_level warning; ff_log_level warning;
# the log tank, console or file. # the log tank, console or file.
# if console, print log to console. # if console, print log to console.

View file

@ -5785,7 +5785,7 @@ string SrsConfig::get_ff_log_dir()
string SrsConfig::get_ff_log_level() string SrsConfig::get_ff_log_level()
{ {
static string DEFAULT = "warning"; static string DEFAULT = "info";
SrsConfDirective* conf = root->get("ff_log_level"); SrsConfDirective* conf = root->get("ff_log_level");
if (!conf || conf->arg0().empty()) { if (!conf || conf->arg0().empty()) {

View file

@ -152,7 +152,7 @@ srs_error_t srs_redirect_output(string from_file, int to_fd)
// redirect the fd to file. // redirect the fd to file.
int fd = -1; int fd = -1;
int flags = O_CREAT|O_WRONLY|O_APPEND; int flags = O_CREAT|O_RDWR|O_APPEND;
mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH;
if ((fd = ::open(from_file.c_str(), flags, mode)) < 0) { if ((fd = ::open(from_file.c_str(), flags, mode)) < 0) {
@ -197,10 +197,7 @@ srs_error_t SrsProcess::start()
// ignore the SIGINT and SIGTERM // ignore the SIGINT and SIGTERM
signal(SIGINT, SIG_IGN); signal(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN); signal(SIGTERM, SIG_IGN);
// for the stdin,
// should never close it or ffmpeg will error.
// for the stdout, ignore when not specified. // for the stdout, ignore when not specified.
// redirect stdout to file if possible. // redirect stdout to file if possible.
if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) { if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) {
@ -212,16 +209,22 @@ srs_error_t SrsProcess::start()
if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) { if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) {
return srs_error_wrap(err, "redirect output"); return srs_error_wrap(err, "redirect output");
} }
// No stdin for process, @bug https://github.com/ossrs/srs/issues/1592
if ((err = srs_redirect_output("/dev/null", STDIN_FILENO)) != srs_success) {
return srs_error_wrap(err, "redirect input");
}
// should never close the fd 3+, for it myabe used. // should never close the fd 3+, for it myabe used.
// for fd should close at exec, use fnctl to set it. // for fd should close at exec, use fnctl to set it.
// log basic info to stderr. // log basic info to stderr.
if (true) { if (true) {
fprintf(stderr, "\n"); fprintf(stdout, "\n");
fprintf(stderr, "process ppid=%d, cid=%d, pid=%d\n", ppid, cid, getpid()); fprintf(stdout, "process ppid=%d, cid=%d, pid=%d, in=%d, out=%d, err=%d\n",
fprintf(stderr, "process binary=%s, cli: %s\n", bin.c_str(), cli.c_str()); ppid, cid, getpid(), STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO);
fprintf(stderr, "process actual cli: %s\n", actual_cli.c_str()); fprintf(stdout, "process binary=%s, cli: %s\n", bin.c_str(), cli.c_str());
fprintf(stdout, "process actual cli: %s\n", actual_cli.c_str());
} }
// memory leak in child process, it's ok. // memory leak in child process, it's ok.

View file

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP #ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP #define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 114 #define SRS_VERSION3_REVISION 115
#endif #endif