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

quit child process when fork failed.

This commit is contained in:
winlin 2015-11-02 11:44:22 +08:00
parent f57e537686
commit 9d7826c681

View file

@ -137,13 +137,13 @@ int SrsProcess::start()
if ((stdout_fd = ::open(stdout_file.c_str(), flags, mode)) < 0) {
ret = ERROR_ENCODER_OPEN;
fprintf(stderr, "open process stdout %s failed. ret=%d", stdout_file.c_str(), ret);
return ret;
exit(ret);
}
if (dup2(stdout_fd, STDOUT_FILENO) < 0) {
ret = ERROR_ENCODER_DUP2;
srs_error("dup2 process stdout failed. ret=%d", ret);
return ret;
exit(ret);
}
}
@ -156,13 +156,13 @@ int SrsProcess::start()
if ((stderr_fd = ::open(stderr_file.c_str(), flags, mode)) < 0) {
ret = ERROR_ENCODER_OPEN;
fprintf(stderr, "open process stderr %s failed. ret=%d", stderr_file.c_str(), ret);
return ret;
exit(ret);
}
if (dup2(stderr_fd, STDERR_FILENO) < 0) {
ret = ERROR_ENCODER_DUP2;
srs_error("dup2 process stderr failed. ret=%d", ret);
return ret;
exit(ret);
}
}